
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_CN">
  <head>
    <meta charset="utf-8" />
    <title>TPIClient类 &#8212; PyKBase 2.0.0 文档</title>
    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/language_data.js"></script>
    <script type="text/javascript" src="_static/translations.js"></script>
    <link rel="index" title="索引" href="genindex.html" />
    <link rel="search" title="搜索" href="search.html" />
    <link rel="next" title="TPIClient_Struct内容" href="TPIClient_Struct.html" />
    <link rel="prev" title="cursor类" href="cursor.html" />
   
  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="tpiclient">
<h1>TPIClient类<a class="headerlink" href="#tpiclient" title="永久链接至标题">¶</a></h1>
<dl class="class">
<dt id="TPIClient">
<em class="property">class </em><code class="sig-name descname">TPIClient</code><a class="headerlink" href="#TPIClient" title="永久链接至目标">¶</a></dt>
<dd><dl class="method">
<dt id="TPIClient.setConnection">
<code class="sig-name descname">setConnection</code><span class="sig-paren">(</span><em class="sig-param">conn</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setConnection" title="永久链接至目标">¶</a></dt>
<dd><p>设置连接对象</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>conn</strong> – 连接对象.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">()</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">setConnection</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getConnection">
<code class="sig-name descname">getConnection</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getConnection" title="永久链接至目标">¶</a></dt>
<dd><p>获取连接对象</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 连接对象)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">setConnection</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getConnection</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setCursor">
<code class="sig-name descname">setCursor</code><span class="sig-paren">(</span><em class="sig-param">cur</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setCursor" title="永久链接至目标">¶</a></dt>
<dd><p>设置游标对象</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>cur</strong> – 游标对象.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from CJFD0608&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>

<span class="n">cur</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getCursor</span><span class="p">()</span>
<span class="k">if</span> <span class="n">cur</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getCursor">
<code class="sig-name descname">getCursor</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getCursor" title="永久链接至目标">¶</a></dt>
<dd><p>获取游标对象</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 游标对象)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from CJFD0608&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getCursor</span><span class="p">()</span>

<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getErrorMsg">
<code class="sig-name descname">getErrorMsg</code><span class="sig-paren">(</span><em class="sig-param">errcode</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getErrorMsg" title="永久链接至目标">¶</a></dt>
<dd><p>根据错误代码,取错误信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>errcode</strong> – 错误码.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 错误信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getErrorMsg</span><span class="p">(</span><span class="o">-</span><span class="mi">3001</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(-3001, &#39;当前指令要操作的视图不存在 , 错误码: -3001&#39;)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.writeLog">
<code class="sig-name descname">writeLog</code><span class="sig-paren">(</span><em class="sig-param">errinfo</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.writeLog" title="永久链接至目标">¶</a></dt>
<dd><p>写日志文件.日志文件保存在工作目录下的子目录：LogFiles,文件名形为 KBYYYYMMDD.LOG,此目录必须事先建立起来,并且本程序有它的读写权限才可正常记录日志</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>errinfo</strong> – 日志信息.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getLogFilePath">
<code class="sig-name descname">getLogFilePath</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getLogFilePath" title="永久链接至目标">¶</a></dt>
<dd><p>获取日志文件路径.日志文件保存该目录下,此目录必须事先建立起来,并且本程序有它的读写权限才可正常记录日志</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 日志文件路径)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getLogFilePath</span><span class="p">(</span><span class="o">-</span><span class="mi">3001</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(1, &#39;C:\\Python33\\LogFiles\\KBase\\&#39;)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.openCon">
<code class="sig-name descname">openCon</code><span class="sig-paren">(</span><em class="sig-param">host</em>, <em class="sig-param">port</em>, <em class="sig-param">loginpara</em><span class="optional">[</span>, <em class="sig-param">extype</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.openCon" title="永久链接至目标">¶</a></dt>
<dd><p>建立服务器通信连接(一般情况下只要打开一次连接,关闭一次连接即可)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host</strong> – 服务器IP.</p></li>
<li><p><strong>port</strong> – 通信端口(缺省为4567).</p></li>
<li><p><strong>loginpara</strong> – 登录参数(包含:用户名称、用户密码、用户IP).</p></li>
<li><p><strong>extype</strong> – 扩展属性,暂时不用.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 连接对象)</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p class="rubric">loginpara</p>
<dl class="citation">
<dt class="label" id="szusername"><span class="brackets">szUserName</span></dt>
<dd><p>必需.用户密码.</p>
</dd>
<dt class="label" id="szpassword"><span class="brackets">szPassWord</span></dt>
<dd><p>必需.用户IP.</p>
</dd>
<dt class="label" id="userip"><span class="brackets">UserIp</span></dt>
<dd><p>用户设定或清0.</p>
</dd>
</dl>
</div>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">loginPara</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_LOGIN_PARA</span><span class="p">()</span>
<span class="n">loginPara</span><span class="o">.</span><span class="n">szUserName</span> <span class="o">=</span> <span class="s1">&#39;DBOWN&#39;</span>
<span class="n">loginPara</span><span class="o">.</span><span class="n">szPassWord</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
<span class="n">UserIp</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_IP</span><span class="p">()</span>
<span class="n">UserIp</span><span class="o">.</span><span class="n">szIp</span> <span class="o">=</span> <span class="s1">&#39;127.0.0.1&#39;</span>
<span class="n">loginPara</span><span class="o">.</span><span class="n">UserIp</span> <span class="o">=</span> <span class="n">UserIp</span>
<span class="n">nPort</span> <span class="o">=</span> <span class="mi">4567</span>
<span class="n">pServerHost</span> <span class="o">=</span> <span class="s1">&#39;127.0.0.1&#39;</span>
<span class="c1">#conn = KBase.connect()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">()</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openCon</span><span class="p">(</span><span class="n">pServerHost</span><span class="p">,</span> <span class="n">nPort</span><span class="p">,</span> <span class="n">loginPara</span><span class="p">)</span>

<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">hcon</span><span class="p">)</span><span class="c1">#1025</span>
    <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.openCon2">
<code class="sig-name descname">openCon2</code><span class="sig-paren">(</span><em class="sig-param">host</em>, <em class="sig-param">port</em>, <em class="sig-param">loginpara</em><span class="optional">[</span>, <em class="sig-param">extype</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.openCon2" title="永久链接至目标">¶</a></dt>
<dd><p>建立服务器通信连接(一般情况下只要打开一次连接,关闭一次连接即可),目前和TPI_OpenCon功能相同</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host</strong> – 服务器IP</p></li>
<li><p><strong>port</strong> – 通信端口(缺省为4567)</p></li>
<li><p><strong>loginpara</strong> – 登录参数(包含:用户名称、用户密码、用户IP)</p></li>
<li><p><strong>extype</strong> – 扩展属性,暂时不用.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 连接对象)</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p class="rubric">loginpara</p>
<dl class="citation">
<dt class="label" id="id1"><span class="brackets">szUserName</span></dt>
<dd><p>必需.用户密码.</p>
</dd>
<dt class="label" id="id2"><span class="brackets">szPassWord</span></dt>
<dd><p>必需.用户IP.</p>
</dd>
<dt class="label" id="id3"><span class="brackets">UserIp</span></dt>
<dd><p>用户设定或清0.</p>
</dd>
</dl>
<p>该接口目前和openCon功能相同</p>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.reconnect">
<code class="sig-name descname">reconnect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.reconnect" title="永久链接至目标">¶</a></dt>
<dd><p>重新连接.即更新 hcon 与服务器的底层连接(即FTSClient.dll提供的连接).</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">reconnect</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.closeCon">
<code class="sig-name descname">closeCon</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.closeCon" title="永久链接至目标">¶</a></dt>
<dd><p>关闭与服务器建立的通信连接</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">closeCon</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.isValidCon">
<code class="sig-name descname">isValidCon</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.isValidCon" title="永久链接至目标">¶</a></dt>
<dd><p>判断一个连接是否有效</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">isValidCon</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.isActiveCon">
<code class="sig-name descname">isActiveCon</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.isActiveCon" title="永久链接至目标">¶</a></dt>
<dd><p>检查数据库连接状态.检查服务器状态及账号信息,并更新此数据库连接的最后操作时间</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">isActiveCon</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.refreshCon">
<code class="sig-name descname">refreshCon</code><span class="sig-paren">(</span><em class="sig-param">seconds</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.refreshCon" title="永久链接至目标">¶</a></dt>
<dd><p>刷新数据库连接状态.检查服务器状态及账号信息, 并更新此数据库连接的最后操作时间,同时更新此数据库连接打开的结果集的最后操作时间,以保持结果集不因超时被关闭</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>seconds</strong> – 超时时间.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">refreshCon</span><span class="p">(</span><span class="mi">600</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.checkServerState">
<code class="sig-name descname">checkServerState</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.checkServerState" title="永久链接至目标">¶</a></dt>
<dd><p>检查服务器状态.不检查账号信息，只要数据库连接状态正常，即使此账号当前已经被剔除也可</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">checkServerState</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.execSQL">
<code class="sig-name descname">execSQL</code><span class="sig-paren">(</span><em class="sig-param">sql</em><span class="optional">[</span>, <em class="sig-param">args</em>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.execSQL" title="永久链接至目标">¶</a></dt>
<dd><p>主要用于执行TPI SQL中非SELECT(如：Update,Delete …)等SQL操作</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sql</strong> – KSQL语句.</p></li>
<li><p><strong>args</strong> – KSQL语句参数(可选).</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">execSQL</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">execSQL</span><span class="p">(</span><span class="s2">&quot;insert into TABLE1(姓名,学号,NAME) values(&#39;郑一&#39;,&#39;1100&#39;,&#39;a1&#39;)&quot;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">execSQL</span><span class="p">(</span><span class="s2">&quot;insert into TABLE1(姓名,学号,NAME) values(:1, :2, :3)&quot;</span><span class="p">,</span> <span class="p">(</span><span class="s2">&quot;王一&quot;</span><span class="p">,</span><span class="s2">&quot;1001&quot;</span><span class="p">,</span><span class="s2">&quot;aa&quot;</span><span class="p">))</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">execSQL</span><span class="p">(</span><span class="s2">&quot;insert into TABLE1(姓名,学号,NAME) values(:姓名, :学号, :NAME)&quot;</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;姓名&#39;</span><span class="p">:</span><span class="s1">&#39;王二&#39;</span><span class="p">,</span> <span class="s1">&#39;学号&#39;</span><span class="p">:</span><span class="s1">&#39;1002&#39;</span><span class="p">,</span> <span class="s1">&#39;NAME&#39;</span><span class="p">:</span><span class="s1">&#39;bb&#39;</span><span class="p">})</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">execSQL</span><span class="p">(</span><span class="s2">&quot;insert into TABLE1(姓名,学号,NAME) values(</span><span class="si">%(姓名)s</span><span class="s2">, </span><span class="si">%(学号)s</span><span class="s2">, </span><span class="si">%(NAME)s</span><span class="s2">)&quot;</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;姓名&#39;</span><span class="p">:</span><span class="s1">&#39;王三&#39;</span><span class="p">,</span> <span class="s1">&#39;学号&#39;</span><span class="p">:</span><span class="s1">&#39;1003&#39;</span><span class="p">,</span> <span class="s1">&#39;NAME&#39;</span><span class="p">:</span><span class="s1">&#39;cc&#39;</span><span class="p">})</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">execSQL</span><span class="p">(</span><span class="s2">&quot;insert into TABLE1(姓名,学号,NAME) values(?, ?, ?)&quot;</span><span class="p">,</span> <span class="p">(</span><span class="s2">&quot;王四&quot;</span><span class="p">,</span><span class="s2">&quot;1004&quot;</span><span class="p">,</span><span class="s2">&quot;dd&quot;</span><span class="p">))</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">execSQL</span><span class="p">(</span><span class="s2">&quot;insert into TABLE1(姓名,学号,NAME) values(</span><span class="si">%s</span><span class="s2">, </span><span class="si">%s</span><span class="s2">, </span><span class="si">%s</span><span class="s2">)&quot;</span><span class="p">,</span> <span class="p">(</span><span class="s2">&quot;王五&quot;</span><span class="p">,</span><span class="s2">&quot;1005&quot;</span><span class="p">,</span><span class="s2">&quot;ee&quot;</span><span class="p">))</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.execMgrSql">
<code class="sig-name descname">execMgrSql</code><span class="sig-paren">(</span><em class="sig-param">(sql</em><span class="optional">[</span>, <em class="sig-param">args</em>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.execMgrSql" title="永久链接至目标">¶</a></dt>
<dd><p>执行SQL语句,得到事件执行的句柄</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sql</strong> – KSQL语句.</p></li>
<li><p><strong>args</strong> – KSQL语句参数(可选).</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|事件句柄,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">eventhandle</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">execMgrSql</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1 where NAME = </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="p">(</span><span class="s2">&quot;王五&quot;</span><span class="p">,))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">eventhandle</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#282</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.checkSql">
<code class="sig-name descname">checkSql</code><span class="sig-paren">(</span><em class="sig-param">(sql</em><span class="optional">[</span>, <em class="sig-param">args</em>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.checkSql" title="永久链接至目标">¶</a></dt>
<dd><p>检查SQL语句的语法</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sql</strong> – KSQL语句.</p></li>
<li><p><strong>args</strong> – KSQL语句参数(可选).</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">checkSql</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#0</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">checkSql</span><span class="p">(</span><span class="s2">&quot;insert into TABLE1(姓名,学号,NAME) values(&#39;郑一&#39;,&#39;1100&#39;,&#39;a1&#39;)&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#0</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">checkSql</span><span class="p">(</span><span class="s2">&quot;insert into TABLE1(姓名,学号,NAME) values(?, ?, ?)&quot;</span><span class="p">,</span> <span class="p">(</span><span class="s2">&quot;王四&quot;</span><span class="p">,</span><span class="s2">&quot;1004&quot;</span><span class="p">,</span><span class="s2">&quot;dd&quot;</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#0</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">checkSql</span><span class="p">(</span><span class="s2">&quot;insert intoo TABLE1(姓名,学号,NAME) values(?, ?, ?)&quot;</span><span class="p">,</span> <span class="p">(</span><span class="s2">&quot;王四&quot;</span><span class="p">,</span><span class="s2">&quot;1004&quot;</span><span class="p">,</span><span class="s2">&quot;dd&quot;</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#-3506</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableCount">
<code class="sig-name descname">getTableCount</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableCount" title="永久链接至目标">¶</a></dt>
<dd><p>返回表的个数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getTableCount</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#38</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableNameBySn">
<code class="sig-name descname">getTableNameBySn</code><span class="sig-paren">(</span><em class="sig-param">sn</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableNameBySn" title="永久链接至目标">¶</a></dt>
<dd><p>根据序号取表名</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>sn</strong> – 表序号.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 表名)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getTableNameBySn</span><span class="p">(</span><span class="mi">34</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(0, &#39;SYS_USER_IP&#39;)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getTableNameBySn</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(-1100,)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.tableNameExists">
<code class="sig-name descname">tableNameExists</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.tableNameExists" title="永久链接至目标">¶</a></dt>
<dd><p>判断表名是否存在</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="c1">#返回1表示存在,返回0表示不存在</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">tableNameExists</span><span class="p">(</span><span class="s1">&#39;CJFD0608&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(1,)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">tableNameExists</span><span class="p">(</span><span class="s1">&#39;CJFD0609&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(0,)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getViewCount">
<code class="sig-name descname">getViewCount</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getViewCount" title="永久链接至目标">¶</a></dt>
<dd><p>返回视图的个数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|视图个数,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getViewCount</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(1,)#(1,)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getViewNameBySn">
<code class="sig-name descname">getViewNameBySn</code><span class="sig-paren">(</span><em class="sig-param">sn</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getViewNameBySn" title="永久链接至目标">¶</a></dt>
<dd><p>根据序号取视图名称</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>sn</strong> – 视图号.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 视图名)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getViewNameBySn</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(1,)#(0, &#39;TABLEVIEW&#39;)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.viewNameExists">
<code class="sig-name descname">viewNameExists</code><span class="sig-paren">(</span><em class="sig-param">viewname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.viewNameExists" title="永久链接至目标">¶</a></dt>
<dd><p>判断视图名称是否存在</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>viewname</strong> – 视图名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="c1">#返回1表示存在,返回0表示不存在</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">viewNameExists</span><span class="p">(</span><span class="s1">&#39;TABLEVIEW&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(1,)#(1,)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">viewNameExists</span><span class="p">(</span><span class="s1">&#39;TABLEVIEW1&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(1,)#(0,)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getViewSQL">
<code class="sig-name descname">getViewSQL</code><span class="sig-paren">(</span><em class="sig-param">viewname</em><span class="optional">[</span>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getViewSQL" title="永久链接至目标">¶</a></dt>
<dd><p>得到视图对应的KSQL语句</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>viewname</strong> – 视图名.</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, KSQL语句)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getViewSQL</span><span class="p">(</span><span class="s1">&#39;TABLEVIEW&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(0, &#39;select * from TABLE1  where&#39;)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.refreshTable">
<code class="sig-name descname">refreshTable</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.refreshTable" title="永久链接至目标">¶</a></dt>
<dd><p>刷新服务器表的信息.可能在其它并发用户增加、删除、修改表后，表信息有变，用此函数以同步可能的变化</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">refreshTable</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.openRecordSet">
<code class="sig-name descname">openRecordSet</code><span class="sig-paren">(</span><em class="sig-param">sql</em><span class="optional">[</span>, <em class="sig-param">args</em>, <em class="sig-param">exectype</em>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.openRecordSet" title="永久链接至目标">¶</a></dt>
<dd><p>执行sql检索</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sql</strong> – KSQL语句.</p></li>
<li><p><strong>args</strong> – KSQL语句参数(可选).</p></li>
<li><p><strong>exectype</strong> – 检索类型(可选).</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 游标对象)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from CJFD0608&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span> 
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;open record set:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#open record set: 0</span>

<span class="n">tpiclient</span><span class="o">.</span><span class="n">closeRecordSet</span><span class="p">()</span>
<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.openRecordSetEx">
<code class="sig-name descname">openRecordSetEx</code><span class="sig-paren">(</span><em class="sig-param">sql</em><span class="optional">[</span>, <em class="sig-param">args</em>, <em class="sig-param">exectype</em>, <em class="sig-param">flag</em>, <em class="sig-param">waitsecond</em>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.openRecordSetEx" title="永久链接至目标">¶</a></dt>
<dd><p>执行sql检索</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sql</strong> – KSQL语句.</p></li>
<li><p><strong>args</strong> – KSQL语句参数(可选).</p></li>
<li><p><strong>exectype</strong> – 检索类型(可选).</p></li>
<li><p><strong>flag</strong> – 标识(可选).</p></li>
<li><p><strong>waitsecond</strong> – 查询超时时间(可选)</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 游标对象)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSetEx</span><span class="p">(</span><span class="s2">&quot;select * from CJFD0608&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;open record set ex:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#open record set ex: 0</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">closeRecordSet</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.openRecordSet2">
<code class="sig-name descname">openRecordSet2</code><span class="sig-paren">(</span><em class="sig-param">info</em><span class="optional">[</span>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.openRecordSet2" title="永久链接至目标">¶</a></dt>
<dd><p>执行sql检索</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>info</strong> – 检索参数信息.</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 游标对象)</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p class="rubric">info</p>
<dl class="citation">
<dt class="label" id="pszsql"><span class="brackets">pszSQL</span></dt>
<dd><p>KSQL表达式.</p>
</dd>
<dt class="label" id="nexectype"><span class="brackets">nExecType</span></dt>
<dd><p>表示执行sql检索的类型,默认值0(即EXEC_NORMAL).类型的枚举值参见TPI_CMDCODE_EXEC_SQL_SUBCMD.</p>
</dd>
<dt class="label" id="nflag"><span class="brackets">nFlag</span></dt>
<dd><p>标识,取值见 TPI_RECORDSET_OPEN_FLAG,默认为 TROF_NORMAL(=0).</p>
</dd>
<dt class="label" id="nwaitsecond"><span class="brackets">nWaitSecond</span></dt>
<dd><p>查询超时时间,如果nWaitSecond&lt;=0，取默认值SQL_CMD_DEFAULT_SECONDS.</p>
</dd>
<dt class="label" id="nreccount"><span class="brackets">nRecCount</span></dt>
<dd><p>打开结果集同时返回的记录个数,默认值0.</p>
</dd>
<dt class="label" id="szprefix"><span class="brackets">szPrefix</span></dt>
<dd><p>标红前缀,默认为空</p>
</dd>
<dt class="label" id="szpostfix"><span class="brackets">szPostfix</span></dt>
<dd><p>标红后缀,默认为空</p>
</dd>
<dt class="label" id="szreserved"><span class="brackets">szReserved</span></dt>
<dd><p>保留,默认为空</p>
</dd>
</dl>
<p>其中pszSQL不能为NULL值,其他成员均有默认值</p>
</div>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">openrecset</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_OPEN_RECORDSET</span><span class="p">()</span>
<span class="n">openrecset</span><span class="o">.</span><span class="n">pszSQL</span> <span class="o">=</span> <span class="s1">&#39;select * from CJFD0608&#39;</span>
<span class="n">openrecset</span><span class="o">.</span><span class="n">nExecType</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">openrecset</span><span class="o">.</span><span class="n">nFlag</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">openrecset</span><span class="o">.</span><span class="n">nWaitSecond</span> <span class="o">=</span> <span class="mi">20</span>
<span class="n">openrecset</span><span class="o">.</span><span class="n">szPostfix</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">openrecset</span><span class="o">.</span><span class="n">szPrefix</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet2</span><span class="p">(</span><span class="n">openrecset</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;open record set2:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">hSet</span><span class="p">)</span><span class="c1">#open record set2: 0 | 1025</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">closeRecordSetEx</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.closeRecordSet">
<code class="sig-name descname">closeRecordSet</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.closeRecordSet" title="永久链接至目标">¶</a></dt>
<dd><p>延迟关闭对应的记录集句柄</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">closeRecordSet</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;close record set:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#close record set: 0</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.closeRecordSetEx">
<code class="sig-name descname">closeRecordSetEx</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">flag</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.closeRecordSetEx" title="永久链接至目标">¶</a></dt>
<dd><p>关闭对应的记录集句柄</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>flag</strong> – 标识(可选).</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSetEx</span><span class="p">(</span><span class="s2">&quot;select * from CJFD0608&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">closeRecordSetEx</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> 
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;close record set ex:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#close record set ex: 0</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.validateQuery">
<code class="sig-name descname">validateQuery</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.validateQuery" title="永久链接至目标">¶</a></dt>
<dd><p>更新结果集时间,避免超时失效</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">validateQuery</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;validate query:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#validate query: 0</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.isValidRecordset">
<code class="sig-name descname">isValidRecordset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.isValidRecordset" title="永久链接至目标">¶</a></dt>
<dd><p>判断一个结果集是否有效</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">isValidRecordset</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;is valid record set:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#is valid record set: 0</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setHitWordMarkFlag">
<code class="sig-name descname">setHitWordMarkFlag</code><span class="sig-paren">(</span><em class="sig-param">prefix</em>, <em class="sig-param">postfix</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setHitWordMarkFlag" title="永久链接至目标">¶</a></dt>
<dd><p>设置记录是否要标红.prefix, postfix是0结束的串,长度不超过15字符</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>prefix</strong> – 标记前缀.</p></li>
<li><p><strong>postfix</strong> – 标记后缀.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">prefix</span> <span class="o">=</span> <span class="s1">&#39;&lt;##&#39;</span>
    <span class="n">endfix</span> <span class="o">=</span> <span class="s1">&#39;##&gt;&#39;</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">setHitWordMarkFlag</span><span class="p">(</span><span class="n">prefix</span><span class="p">,</span> <span class="n">endfix</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;set hitword mark flag:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#set hitword mark flag: 0</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getRecordSet">
<code class="sig-name descname">getRecordSet</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getRecordSet" title="永久链接至目标">¶</a></dt>
<dd><p>由记录集句柄hSet得到对应的记录集</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 记录集)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getRecordSet</span><span class="p">()</span>
    <span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;HitCount:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">hQuery</span><span class="o">.</span><span class="n">nHitCount</span><span class="p">)</span><span class="c1">#HitCount: 60</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getRecordSetCount">
<code class="sig-name descname">getRecordSetCount</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getRecordSetCount" title="永久链接至目标">¶</a></dt>
<dd><p>返回记录集hSet中的记录个数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getRecordSetCount</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get record set count:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get record set count: 60</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.moveFirst">
<code class="sig-name descname">moveFirst</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.moveFirst" title="永久链接至目标">¶</a></dt>
<dd><p>移动到记录集的第一条记录上(记录的位置偏移从1开始)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">moveFirst</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;move first:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">cur</span><span class="o">.</span><span class="n">fetchone</span><span class="p">())</span><span class="c1">#move first: True | (&#39;王四&#39;, 1004, &#39;dd4&#39;)</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.moveNext">
<code class="sig-name descname">moveNext</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.moveNext" title="永久链接至目标">¶</a></dt>
<dd><p>移动到记录集的下一条记录上(相对当前位置)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">moveNext</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;move next:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">cur</span><span class="o">.</span><span class="n">fetchone</span><span class="p">())</span><span class="c1">#move next: True | (&#39;王五&#39;, 1005, &#39;ee5&#39;)</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.movePrev">
<code class="sig-name descname">movePrev</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.movePrev" title="永久链接至目标">¶</a></dt>
<dd><p>移动到记录集的上一条记录上(相对当前位置)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">moveLast</span><span class="p">()</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">movePrev</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;move prev:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">cur</span><span class="o">.</span><span class="n">fetchone</span><span class="p">())</span><span class="c1">#move prev: True | (&#39;王九&#39;, 1009, &#39;ii&#39;)</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.moveLast">
<code class="sig-name descname">moveLast</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.moveLast" title="永久链接至目标">¶</a></dt>
<dd><p>移动到记录集的最后一条记录上</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">moveLast</span><span class="p">()</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">movePrev</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;move prev:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">cur</span><span class="o">.</span><span class="n">fetchone</span><span class="p">())</span><span class="c1">#move prev: True | (&#39;王九&#39;, 1009, &#39;ii&#39;)</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.move">
<code class="sig-name descname">move</code><span class="sig-paren">(</span><em class="sig-param">pos</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.move" title="永久链接至目标">¶</a></dt>
<dd><p>移动到记录集的指定记录上(绝对位置)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>pos</strong> – 记录绝对位置(基数从1开始).</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;move:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">cur</span><span class="o">.</span><span class="n">fetchone</span><span class="p">())</span><span class="c1">#move: True | (&#39;王七&#39;, 1007, &#39;gg7&#39;)</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.isEOF">
<code class="sig-name descname">isEOF</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.isEOF" title="永久链接至目标">¶</a></dt>
<dd><p>判断记录是否移到记录的最后一个位置的下一条</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">isEOF</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;is EOF:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#is EOF: False</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.isBOF">
<code class="sig-name descname">isBOF</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.isBOF" title="永久链接至目标">¶</a></dt>
<dd><p>判断记录是否移到记录的第一个位置的前一条</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">isBOF</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;is BOF:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#is BOF: False</span>
 
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.addNew">
<code class="sig-name descname">addNew</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.addNew" title="永久链接至目标">¶</a></dt>
<dd><p>设置为增加记录模式</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">addNew</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;add new:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#add new: 2</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.delete">
<code class="sig-name descname">delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.delete" title="永久链接至目标">¶</a></dt>
<dd><p>删除当前记录</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">moveLast</span><span class="p">()</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">movePrev</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;**********&#39;</span><span class="p">,</span><span class="n">cur</span><span class="o">.</span><span class="n">fetchone</span><span class="p">())</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">delete</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;delete:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#delete: 0</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.deletes">
<code class="sig-name descname">deletes</code><span class="sig-paren">(</span><em class="sig-param">nos</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.deletes" title="永久链接至目标">¶</a></dt>
<dd><p>删除多条记录</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>nos</strong> – 记录号元组.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;**********&#39;</span><span class="p">,</span><span class="n">cur</span><span class="o">.</span><span class="n">fetchmany</span><span class="p">(</span><span class="n">size</span> <span class="o">=</span> <span class="mi">4</span><span class="p">))</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">deletes</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">12</span><span class="p">,</span> <span class="mi">13</span><span class="p">))</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;deletes:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#deletes: 0</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.edit">
<code class="sig-name descname">edit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.edit" title="永久链接至目标">¶</a></dt>
<dd><p>设置为编辑记录模式</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">edit</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;edit:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#edit: 1</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">cancelUpdate</span><span class="p">()</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.update">
<code class="sig-name descname">update</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.update" title="永久链接至目标">¶</a></dt>
<dd><p>执行增加、修改记录的写记录操作</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">edit</span><span class="p">()</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">update</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;update:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#update: 20</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.cancelUpdate">
<code class="sig-name descname">cancelUpdate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.cancelUpdate" title="永久链接至目标">¶</a></dt>
<dd><p>取消增加、修改模式</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">update</span><span class="p">()</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">cancelUpdate</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;calcel update:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#calcel update: 1</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setFieldValue">
<code class="sig-name descname">setFieldValue</code><span class="sig-paren">(</span><em class="sig-param">fieldsn</em>, <em class="sig-param">fieldvalue</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setFieldValue" title="永久链接至目标">¶</a></dt>
<dd><p>设置字段的值(通过字段序号).在设置了新增或修改模式后才可调用,新设置的值直到成功调用Update后才效</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fieldsn</strong> – 字段序号.</p></li>
<li><p><strong>fieldvalue</strong> – 字段值</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
    
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">edit</span><span class="p">()</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">setFieldValue</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;kk12&#39;</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">update</span><span class="p">()</span>
    
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldValue</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(8, &#39;kk12&#39;)</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
    
<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setFieldValueByName">
<code class="sig-name descname">setFieldValueByName</code><span class="sig-paren">(</span><em class="sig-param">fieldname</em>, <em class="sig-param">fieldvalue</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setFieldValueByName" title="永久链接至目标">¶</a></dt>
<dd><p>设置字段的值(通过字段名称).在设置了新增或修改模式后才可调用，新设置的值直到成功调用Update后才效</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fieldname</strong> – 字段名.</p></li>
<li><p><strong>fieldvalue</strong> – 字段值</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
    
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">edit</span><span class="p">()</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">setFieldValueByName</span><span class="p">(</span><span class="s1">&#39;学号&#39;</span><span class="p">,</span> <span class="s1">&#39;1012&#39;</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">update</span><span class="p">()</span>
    
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldValueByName</span><span class="p">(</span><span class="s1">&#39;学号&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(8, &#39;kk12&#39;)#(8, &#39;1012&#39;)</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldValue">
<code class="sig-name descname">getFieldValue</code><span class="sig-paren">(</span><em class="sig-param">fieldsn</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldValue" title="永久链接至目标">¶</a></dt>
<dd><p>取字段的值(通过字段序号)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldsn</strong> – 字段序号.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 字段值)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldValue</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;field value:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#field value: kk12</span>
   
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldValueEx">
<code class="sig-name descname">getFieldValueEx</code><span class="sig-paren">(</span><em class="sig-param">fieldsn</em><span class="optional">[</span>, <em class="sig-param">flag</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldValueEx" title="永久链接至目标">¶</a></dt>
<dd><p>取字段的值(通过字段序号)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fieldsn</strong> – 字段号.</p></li>
<li><p><strong>flag</strong> – 标识(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 字段值).</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldValueEx</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get field value ex:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#get field value ex: kk12</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldValueByName">
<code class="sig-name descname">getFieldValueByName</code><span class="sig-paren">(</span><em class="sig-param">fieldname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldValueByName" title="永久链接至目标">¶</a></dt>
<dd><p>取字段的值(通过字段名称)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>filedname</strong> – 字段名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 字段值)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldValueByName</span><span class="p">(</span><span class="s1">&#39;学号&#39;</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;field value:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#field value: 1012</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldValueByNameEx">
<code class="sig-name descname">getFieldValueByNameEx</code><span class="sig-paren">(</span><em class="sig-param">fieldname</em><span class="optional">[</span>, <em class="sig-param">flag</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldValueByNameEx" title="永久链接至目标">¶</a></dt>
<dd><p>取字段的值(通过字段名称)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fieldname</strong> – 字段名.</p></li>
<li><p><strong>flag</strong> – 标识(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 字段值).</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldValueByNameEx</span><span class="p">(</span><span class="s1">&#39;学号&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get field value by name ex:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#get field value by name ex: 1012</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldLen">
<code class="sig-name descname">getFieldLen</code><span class="sig-paren">(</span><em class="sig-param">fieldsn</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldLen" title="永久链接至目标">¶</a></dt>
<dd><p>根据字段序号取字段长度.这里返回的是数据库定义的长度,这与TPI_GetColDataLen不一样,它得到的不是实际数据的长度</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldsn</strong> – 字段号.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|字段长度,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldLen</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get field len:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get field len: 4</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getColDataLen">
<code class="sig-name descname">getColDataLen</code><span class="sig-paren">(</span><em class="sig-param">fieldsn</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getColDataLen" title="永久链接至目标">¶</a></dt>
<dd><p>取每一列的长度.根据字段序号,取记录指定列的数据长度,它与TPI_GetFieldLen不同,它返回的是实际数据的长度</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldsn</strong> – 字段号.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|列长度,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getColDataLen</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get col data len:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get col data len: 8</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getColDataLenEx">
<code class="sig-name descname">getColDataLenEx</code><span class="sig-paren">(</span><em class="sig-param">fieldsn</em><span class="optional">[</span>, <em class="sig-param">flag</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getColDataLenEx" title="永久链接至目标">¶</a></dt>
<dd><p>取每一列的长度.根据字段序号,取记录指定列的数据长度,它与TPI_GetFieldLen不同,它返回的是实际数据的长度</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fieldsn</strong> – 字段号.</p></li>
<li><p><strong>flag</strong> – 标识(可选)</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|列长度,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getColDataLenEx</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get col data len ex:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get col data len ex: 8</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getColDataLenByFieldName">
<code class="sig-name descname">getColDataLenByFieldName</code><span class="sig-paren">(</span><em class="sig-param">fieldname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getColDataLenByFieldName" title="永久链接至目标">¶</a></dt>
<dd><p>取每一列的长度.根据字段名称,取记录指定列的数据长度,它与TPI_GetFieldLen不同,它返回的是实际数据的长度</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldname</strong> – 字段名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|列长度,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getColDataLenByFieldName</span><span class="p">(</span><span class="s1">&#39;NAME&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get col data len by field name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get col data len by field name: 8</span>
 
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getColDataLenByFieldNameEx">
<code class="sig-name descname">getColDataLenByFieldNameEx</code><span class="sig-paren">(</span><em class="sig-param">fieldname</em><span class="optional">[</span>, <em class="sig-param">flag</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getColDataLenByFieldNameEx" title="永久链接至目标">¶</a></dt>
<dd><p>取每一列的长度.根据字段名称,取记录指定列的数据长度,它与TPI_GetFieldLen不同,它返回的是实际数据的长度</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fieldname</strong> – 字段名.</p></li>
<li><p><strong>flag</strong> – 标识(可选)</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|列长度,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getColDataLenByFieldNameEx</span><span class="p">(</span><span class="s1">&#39;NAME&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get col data len by field name ex:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get col data len by field name ex: 8</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getRecordTableName">
<code class="sig-name descname">getRecordTableName</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getRecordTableName" title="永久链接至目标">¶</a></dt>
<dd><p>取当前记录所对应表的表名</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 表名)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getRecordTableName</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get record table name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#get record table name: TABLE1</span>
 
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldCount">
<code class="sig-name descname">getFieldCount</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldCount" title="永久链接至目标">¶</a></dt>
<dd><p>取当前记录集的字段个数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|字段个数,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldCount</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;field count:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#field count: 3</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldInfo">
<code class="sig-name descname">getFieldInfo</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldInfo" title="永久链接至目标">¶</a></dt>
<dd><p>取当前记录所对应表的字段信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 字段信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldInfo</span><span class="p">()</span>
    <span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
        <span class="n">field</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;field info:&#39;</span><span class="p">,</span> <span class="n">field</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">field</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">field</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">)</span><span class="c1">#field info: 姓名 | 学号 | NAME</span>

    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldName">
<code class="sig-name descname">getFieldName</code><span class="sig-paren">(</span><em class="sig-param">fieldsn</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldName" title="永久链接至目标">¶</a></dt>
<dd><p>据字段序号取字段名称</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldsn</strong> – 字段号.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 字段名)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldName</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;field name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#field name: 学号</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getRecordSetFieldName">
<code class="sig-name descname">getRecordSetFieldName</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">flag</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getRecordSetFieldName" title="永久链接至目标">¶</a></dt>
<dd><p>得到记录集对应的全部字段名称</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>flag</strong> – 标识(可选)</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 全部字段名列表)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getRecordSetFieldName</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get record set field name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#get record set field name: 姓名,学号,NAME,</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldIndex">
<code class="sig-name descname">getFieldIndex</code><span class="sig-paren">(</span><em class="sig-param">tablename</em>, <em class="sig-param">fieldname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldIndex" title="永久链接至目标">¶</a></dt>
<dd><p>通过字段名字获得字段的位置句柄</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名.</p></li>
<li><p><strong>fieldname</strong> – 字段名.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldIndex</span><span class="p">(</span><span class="s1">&#39;TABLE1&#39;</span><span class="p">,</span> <span class="s1">&#39;学号&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get field index:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get field index: 1</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldType">
<code class="sig-name descname">getFieldType</code><span class="sig-paren">(</span><em class="sig-param">fieldsn</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldType" title="永久链接至目标">¶</a></dt>
<dd><p>根据字段序号取字段类型</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldsn</strong> – 字段号.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|字段类型,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldType</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get field type:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get field type: 1030</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldTypeByName">
<code class="sig-name descname">getFieldTypeByName</code><span class="sig-paren">(</span><em class="sig-param">fieldname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldTypeByName" title="永久链接至目标">¶</a></dt>
<dd><p>据字段序号取字段名称</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldname</strong> – 字段名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|字段类型,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldTypeByName</span><span class="p">(</span><span class="s1">&#39;NAME&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get field type by name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get field type by name: 1030</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldEncodingByName">
<code class="sig-name descname">getFieldEncodingByName</code><span class="sig-paren">(</span><em class="sig-param">fieldname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldEncodingByName" title="永久链接至目标">¶</a></dt>
<dd><p>根据字段名取字段编码</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldname</strong> – 字段名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldEncodingByName</span><span class="p">(</span><span class="s1">&#39;姓名&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get field encoding by name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get field encoding by name: 1</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableHead">
<code class="sig-name descname">getTableHead</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableHead" title="永久链接至目标">¶</a></dt>
<dd><p>取当前记录所对应表的表头信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 表头信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getTableHead</span><span class="p">()</span>
    <span class="n">tablehead</span> <span class="o">=</span> <span class="n">ret</span> <span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;table head:&#39;</span><span class="p">,</span> <span class="n">tablehead</span><span class="o">.</span><span class="n">tableName</span><span class="p">,</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">tablehead</span><span class="o">.</span><span class="n">recNum</span><span class="p">)</span><span class="c1">#table head: TABLE1 | 288</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableSize">
<code class="sig-name descname">getTableSize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableSize" title="永久链接至目标">¶</a></dt>
<dd><p>取当前记录所对应表的大小(以K为单位)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getTableSize</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;table size:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#table size: 72</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTablePath">
<code class="sig-name descname">getTablePath</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTablePath" title="永久链接至目标">¶</a></dt>
<dd><p>取当前记录所对应表的存放路径</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码, 存放路径)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getTablePath</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(9, &#39;E:\\TABLE1&#39;)</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.createTable">
<code class="sig-name descname">createTable</code><span class="sig-paren">(</span><em class="sig-param">tableinfo</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.createTable" title="永久链接至目标">¶</a></dt>
<dd><p>建立表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tableinfo</strong> – 表定义信息.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">tableHead</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_TABLE_HEAD</span><span class="p">()</span>
<span class="n">tableHead</span><span class="o">.</span><span class="n">version</span> <span class="o">=</span> <span class="mi">600</span>
<span class="n">tableHead</span><span class="o">.</span><span class="n">subVersion</span> <span class="o">=</span> <span class="mi">100</span>
<span class="n">tableHead</span><span class="o">.</span><span class="n">tableName</span> <span class="o">=</span> <span class="s2">&quot;TestTable1&quot;</span>
<span class="n">tableHead</span><span class="o">.</span><span class="n">tableAliasName</span> <span class="o">=</span> <span class="s2">&quot;TestTable1&quot;</span>         
<span class="n">tableHead</span><span class="o">.</span><span class="n">fieldNum</span> <span class="o">=</span> <span class="mi">3</span>

<span class="n">Field0</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_TABLE_FIELD</span><span class="p">()</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;ID&quot;</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="mi">3</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">len</span> <span class="o">=</span> <span class="mi">10</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">code</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">indexType</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">indexProperty</span> <span class="o">=</span> <span class="mi">0</span>
 
<span class="n">Field1</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_TABLE_FIELD</span><span class="p">()</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Name&quot;</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">len</span> <span class="o">=</span> <span class="mi">32</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">code</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">indexType</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">indexProperty</span> <span class="o">=</span> <span class="mi">0</span>
  
<span class="n">Field2</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_TABLE_FIELD</span><span class="p">()</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Age&quot;</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="mi">3</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">len</span> <span class="o">=</span> <span class="mi">10</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">code</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">indexType</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">indexProperty</span> <span class="o">=</span> <span class="mi">0</span>
   
<span class="n">tab</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_TABLE_INFO</span><span class="p">()</span>
<span class="n">tab</span><span class="o">.</span><span class="n">szTablePath</span> <span class="o">=</span> <span class="s2">&quot;E:</span><span class="se">\\</span><span class="s2">Test</span><span class="se">\\</span><span class="s2">TestTable1&quot;</span>
<span class="n">tab</span><span class="o">.</span><span class="n">lTableSize</span> <span class="o">=</span> <span class="mi">4096</span>
<span class="n">tab</span><span class="o">.</span><span class="n">TableHead</span> <span class="o">=</span> <span class="n">tableHead</span>
<span class="n">tab</span><span class="o">.</span><span class="n">TableField</span> <span class="o">=</span> <span class="p">(</span><span class="n">Field0</span><span class="p">,</span> <span class="n">Field1</span><span class="p">,</span> <span class="n">Field2</span><span class="p">)</span>

<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">createTable</span><span class="p">(</span><span class="n">tab</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(0,)</span>


<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.createTable2">
<code class="sig-name descname">createTable2</code><span class="sig-paren">(</span><em class="sig-param">tableinfo</em>, <em class="sig-param">dbname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.createTable2" title="永久链接至目标">¶</a></dt>
<dd><p>在指定的数据库中建立表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tableinfo</strong> – 表定义信息.</p></li>
<li><p><strong>dbname</strong> – 数据库名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">tableHead</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_TABLE_HEAD</span><span class="p">()</span>
<span class="n">tableHead</span><span class="o">.</span><span class="n">version</span> <span class="o">=</span> <span class="mi">100</span>
<span class="n">tableHead</span><span class="o">.</span><span class="n">subVersion</span> <span class="o">=</span> <span class="mi">200</span>
<span class="n">tableHead</span><span class="o">.</span><span class="n">tableName</span> <span class="o">=</span> <span class="s2">&quot;TestTable2&quot;</span>
<span class="n">tableHead</span><span class="o">.</span><span class="n">tableAliasName</span> <span class="o">=</span> <span class="s2">&quot;TestTable2&quot;</span>         
<span class="n">tableHead</span><span class="o">.</span><span class="n">fieldNum</span> <span class="o">=</span> <span class="mi">3</span>

<span class="n">Field0</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_TABLE_FIELD</span><span class="p">()</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;ID&quot;</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="mi">3</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">len</span> <span class="o">=</span> <span class="mi">10</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">code</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">indexType</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">Field0</span><span class="o">.</span><span class="n">indexProperty</span> <span class="o">=</span> <span class="mi">0</span>
 
<span class="n">Field1</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_TABLE_FIELD</span><span class="p">()</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Name&quot;</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">len</span> <span class="o">=</span> <span class="mi">32</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">code</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">indexType</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">Field1</span><span class="o">.</span><span class="n">indexProperty</span> <span class="o">=</span> <span class="mi">0</span>
  
<span class="n">Field2</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_TABLE_FIELD</span><span class="p">()</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Age&quot;</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="mi">3</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">len</span> <span class="o">=</span> <span class="mi">10</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">code</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">indexType</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">Field2</span><span class="o">.</span><span class="n">indexProperty</span> <span class="o">=</span> <span class="mi">0</span>
   
<span class="n">tab</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_TABLE_INFO</span><span class="p">()</span>
<span class="n">tab</span><span class="o">.</span><span class="n">szTablePath</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">TestTable2&#39;</span>
<span class="n">tab</span><span class="o">.</span><span class="n">lTableSize</span> <span class="o">=</span> <span class="mi">4096</span>
<span class="n">tab</span><span class="o">.</span><span class="n">TableHead</span> <span class="o">=</span> <span class="n">tableHead</span>
<span class="n">tab</span><span class="o">.</span><span class="n">TableField</span> <span class="o">=</span> <span class="p">(</span><span class="n">Field0</span><span class="p">,</span> <span class="n">Field1</span><span class="p">,</span> <span class="n">Field2</span><span class="p">)</span>

<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">createTable2</span><span class="p">(</span><span class="n">tab</span><span class="p">,</span> <span class="s1">&#39;TEMP&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;create table2:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#create table2: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.deleteTable">
<code class="sig-name descname">deleteTable</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.deleteTable" title="永久链接至目标">¶</a></dt>
<dd><p>删除一个表.删除表后,表仍物理存在,可通过TPI_ImportTable重新引入到系统中</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">importTable</span><span class="p">(</span><span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">TestTable1.dev&#39;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">deleteTable</span><span class="p">(</span><span class="s1">&#39;TestTable1&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;delete table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#delete table: 0</span>
        
<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.modifyTable">
<code class="sig-name descname">modifyTable</code><span class="sig-paren">(</span><em class="sig-param">tableinfo</em>, <em class="sig-param">modiitem</em><span class="optional">[</span>, <em class="sig-param">eventhandle</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.modifyTable" title="永久链接至目标">¶</a></dt>
<dd><p>修改一个表的结构</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tableinfo</strong> – 修改后的表定义信息.</p></li>
<li><p><strong>modiitem</strong> – 原字段对应表数组.</p></li>
<li><p><strong>eventhandle</strong> – 事件句柄(可选)</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">importTable</span><span class="p">(</span><span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">TestTable1.dev&#39;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getTableInfoFromCache</span><span class="p">(</span><span class="s1">&#39;TestTable1&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">tabinfo</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tabinfo</span><span class="o">.</span><span class="n">TableField</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">aliasName</span> <span class="o">=</span> <span class="s1">&#39;标识&#39;</span> <span class="p">;</span>  
    <span class="n">nFieldCount</span> <span class="o">=</span> <span class="n">tabinfo</span><span class="o">.</span><span class="n">TableHead</span><span class="o">.</span><span class="n">fieldNum</span>       
    <span class="n">fieldlist</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="n">fieldlist</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">nFieldCount</span><span class="p">)</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">nFieldCount</span><span class="p">):</span>
        <span class="n">fieldlist</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
    
    <span class="n">pModiItem</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">fieldlist</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">modifyTable</span><span class="p">(</span><span class="n">tabinfo</span><span class="p">,</span> <span class="n">pModiItem</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;modify table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#modify table: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.importTable">
<code class="sig-name descname">importTable</code><span class="sig-paren">(</span><em class="sig-param">tablepath</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.importTable" title="永久链接至目标">¶</a></dt>
<dd><p>引入一个表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablepath</strong> – 表路径.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">importTable</span><span class="p">(</span><span class="s1">&#39;E:\Test\TestTable1.dev&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;import table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#import table: 1</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.packTable">
<code class="sig-name descname">packTable</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.packTable" title="永久链接至目标">¶</a></dt>
<dd><p>整理表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">importTable</span><span class="p">(</span><span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">TestTable1.dev&#39;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">packTable</span><span class="p">(</span><span class="s1">&#39;TestTable1.dev&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;pack table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#pack table: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.indexTable">
<code class="sig-name descname">indexTable</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="optional">[</span>, <em class="sig-param">eventhandle</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.indexTable" title="永久链接至目标">¶</a></dt>
<dd><p>索引表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名.</p></li>
<li><p><strong>eventhandle</strong> – 事件句柄(可选)</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">indexTable</span><span class="p">(</span><span class="s1">&#39;TABLE1&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;index table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#index table: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.indexTableField">
<code class="sig-name descname">indexTableField</code><span class="sig-paren">(</span><em class="sig-param">tablename</em>, <em class="sig-param">cols</em><span class="optional">[</span>, <em class="sig-param">eventhandle</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.indexTableField" title="永久链接至目标">¶</a></dt>
<dd><p>索引表字段</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名.</p></li>
<li><p><strong>cols</strong> – 字段号元组.</p></li>
<li><p><strong>eventhandle</strong> – 事件句柄(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">indexTableField</span><span class="p">(</span><span class="s1">&#39;TABLE1&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;index table field:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#index table field: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.optimizeTable">
<code class="sig-name descname">optimizeTable</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="optional">[</span>, <em class="sig-param">eventhandle</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.optimizeTable" title="永久链接至目标">¶</a></dt>
<dd><p>优化表数据</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名.</p></li>
<li><p><strong>eventhandle</strong> – 事件句柄(可选)</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">optimizeTable</span><span class="p">(</span><span class="s1">&#39;TABLE1&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;optimize table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#optimize table: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.renameTable">
<code class="sig-name descname">renameTable</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="optional">[</span>, <em class="sig-param">aliasname</em>, <em class="sig-param">newname</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.renameTable" title="永久链接至目标">¶</a></dt>
<dd><p>修改表名称或别名.如果只修改表的名称,pAliasName必须为NULL;如果只修改表的别名,pNewName可为NULL,””或与pName相同;如果同时修改表的名称和别名,pNewName和pAliasName为指定值即可</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名.</p></li>
<li><p><strong>aliasname</strong> – 表别名(可选).</p></li>
<li><p><strong>newname</strong> – 表新名(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">renameTable</span><span class="p">(</span><span class="s1">&#39;TESTTABLE1&#39;</span><span class="p">,</span> <span class="s1">&#39;TESTTABLE11&#39;</span><span class="p">,</span> <span class="s1">&#39;TESTTABLE111&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;rename table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#rename table: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getSvrInfo">
<code class="sig-name descname">getSvrInfo</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getSvrInfo" title="永久链接至目标">¶</a></dt>
<dd><p>取服务器详细信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,服务器详细信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getSvrInfo</span><span class="p">()</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">svrinfo</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;svr info:&#39;</span><span class="p">,</span> <span class="n">svrinfo</span><span class="o">.</span><span class="n">HostIP</span><span class="o">.</span><span class="n">szIp</span><span class="p">,</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">svrinfo</span><span class="o">.</span><span class="n">szSvrPath</span><span class="p">)</span><span class="c1">#svr info: 192.168.27.76 | E:\TEMP\Test\Server</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getServerInfo">
<code class="sig-name descname">getServerInfo</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getServerInfo" title="永久链接至目标">¶</a></dt>
<dd><p>获取服务器详细信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,服务器详细列表信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getServerInfo</span><span class="p">()</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">svrinfo</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;server info:&#39;</span><span class="p">,</span> <span class="n">svrinfo</span><span class="o">.</span><span class="n">sysInfo</span><span class="o">.</span><span class="n">szSvrPath</span><span class="p">,</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">svrinfo</span><span class="o">.</span><span class="n">lCurThreadNum</span><span class="p">)</span><span class="c1">#server info: E:\TEMP\Test\Server | 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getServerDiskInfo">
<code class="sig-name descname">getServerDiskInfo</code><span class="sig-paren">(</span><em class="sig-param">diskcnt</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getServerDiskInfo" title="永久链接至目标">¶</a></dt>
<dd><p>取服务器的硬盘列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>diskcnt</strong> – 硬盘个数.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,硬盘列表信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getServerDiskInfo</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">svrinfo</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;server disk info:&#39;</span><span class="p">,</span> <span class="n">svrinfo</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">DiskName</span><span class="p">,</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">svrinfo</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">DiskName</span><span class="p">,</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">svrinfo</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">DiskName</span><span class="p">)</span><span class="c1">#server disk info: C | D | E</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getServerDirCount">
<code class="sig-name descname">getServerDirCount</code><span class="sig-paren">(</span><em class="sig-param">srcpath</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getServerDirCount" title="永久链接至目标">¶</a></dt>
<dd><p>取服务器的指定目录下的目录个数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>srcpath</strong> – 服务器目录路径.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|目录个数,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getServerDirCount</span><span class="p">(</span><span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;server dir count:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#server dir count: 22</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getServerDirList">
<code class="sig-name descname">getServerDirList</code><span class="sig-paren">(</span><em class="sig-param">path</em>, <em class="sig-param">startpos</em>, <em class="sig-param">count</em><span class="optional">[</span>, <em class="sig-param">dirflag</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getServerDirList" title="永久链接至目标">¶</a></dt>
<dd><p>取服务器的目录信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> – 服务器目录路径.</p></li>
<li><p><strong>startpos</strong> – 开始位置.</p></li>
<li><p><strong>count</strong> – 取最多条数.</p></li>
<li><p><strong>dirflag</strong> – 文件目录标识(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|文件或目录个数,文件或目录信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getServerDirList</span><span class="p">(</span><span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">dirinfo</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;server dir list:&#39;</span><span class="p">,</span> <span class="n">dirinfo</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">szName</span><span class="p">,</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">dirinfo</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">szName</span><span class="p">,</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">dirinfo</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">szName</span><span class="p">)</span>
<span class="c1">#server dir list: $RECYCLE.BIN | CNKI_CODE | FTS</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getServerPath">
<code class="sig-name descname">getServerPath</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getServerPath" title="永久链接至目标">¶</a></dt>
<dd><p>取服务器的工作目录路径</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,服务器目录路径)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getServerPath</span><span class="p">()</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;server path:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#server path: E:\TEMP\Test\Server</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.copyFiles">
<code class="sig-name descname">copyFiles</code><span class="sig-paren">(</span><em class="sig-param">copyfile</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.copyFiles" title="永久链接至目标">¶</a></dt>
<dd><p>拷贝文件</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>copyfile</strong> – 文件信息.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">copyfile</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_COPYFILE</span><span class="p">()</span>
<span class="n">copyfile</span><span class="o">.</span><span class="n">szSrcPath</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">STUDENT1.txt&#39;</span>
<span class="n">copyfile</span><span class="o">.</span><span class="n">szDesPath</span> <span class="o">=</span> <span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">&#39;</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">copyFiles</span><span class="p">(</span><span class="n">copyfile</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;copy files:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#copy files: 0</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">deleteFiles</span><span class="p">(</span><span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">STUDENT1.txt&#39;</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.deleteFiles">
<code class="sig-name descname">deleteFiles</code><span class="sig-paren">(</span><em class="sig-param">filename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.deleteFiles" title="永久链接至目标">¶</a></dt>
<dd><p>删除文件</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>filename</strong> – 文件名称.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">copyfile</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_COPYFILE</span><span class="p">()</span>
<span class="n">copyfile</span><span class="o">.</span><span class="n">szSrcPath</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">STUDENT1.txt&#39;</span>
<span class="n">copyfile</span><span class="o">.</span><span class="n">szDesPath</span> <span class="o">=</span> <span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">&#39;</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">copyFiles</span><span class="p">(</span><span class="n">copyfile</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">deleteFiles</span><span class="p">(</span><span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">STUDENT1.txt&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;delete files:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#delete files: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.fileExists">
<code class="sig-name descname">fileExists</code><span class="sig-paren">(</span><em class="sig-param">filename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.fileExists" title="永久链接至目标">¶</a></dt>
<dd><p>判断文件名、目录是否存在</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>filename</strong> – 文件名称.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">fileExists</span><span class="p">(</span><span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">STUDENT1.txt&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;file exists:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#file exists: 1</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.copyDir">
<code class="sig-name descname">copyDir</code><span class="sig-paren">(</span><em class="sig-param">copyfile</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.copyDir" title="永久链接至目标">¶</a></dt>
<dd><p>拷贝目录数据</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>copyfile</strong> – 目录信息.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">copyfile</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_COPYFILE</span><span class="p">()</span>
<span class="n">copyfile</span><span class="o">.</span><span class="n">szSrcPath</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">STUDENT1</span><span class="se">\\</span><span class="s1">&#39;</span>
<span class="n">copyfile</span><span class="o">.</span><span class="n">szDesPath</span> <span class="o">=</span> <span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">STUDENT1</span><span class="se">\\</span><span class="s1">&#39;</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">makeDir</span><span class="p">(</span><span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">STUDENT1</span><span class="se">\\</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">copyDir</span><span class="p">(</span><span class="n">copyfile</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;copy dir:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#copy dir: 0</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">removeDir</span><span class="p">(</span><span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">STUDENT1</span><span class="se">\\</span><span class="s1">&#39;</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.makeDir">
<code class="sig-name descname">makeDir</code><span class="sig-paren">(</span><em class="sig-param">dirpath</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.makeDir" title="永久链接至目标">¶</a></dt>
<dd><p>建立目录</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dirpath</strong> – 目录路径.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">makeDir</span><span class="p">(</span><span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">STUDENT1</span><span class="se">\\</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;make dir:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#make dir: 0</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">removeDir</span><span class="p">(</span><span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">STUDENT1</span><span class="se">\\</span><span class="s1">&#39;</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.removeDir">
<code class="sig-name descname">removeDir</code><span class="sig-paren">(</span><em class="sig-param">dirpath</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.removeDir" title="永久链接至目标">¶</a></dt>
<dd><p>删除目录.此API将删除此目录及目录下所有文件和子目录</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dirpath</strong> – 目录路径.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">makeDir</span><span class="p">(</span><span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">STUDENT1</span><span class="se">\\</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">removeDir</span><span class="p">(</span><span class="s1">&#39;D:</span><span class="se">\\</span><span class="s1">STUDENT1</span><span class="se">\\</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;remove dir:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#remove dir: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.readStruct">
<code class="sig-name descname">readStruct</code><span class="sig-paren">(</span><em class="sig-param">inirw</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.readStruct" title="永久链接至目标">¶</a></dt>
<dd><p>从服务器上的一个INI文件读数据结构.其意义类似于Windows API: GetPrivateProfileStruct</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>inirw</strong> – 文件信息.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,文件信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">inirw</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_INI_READWRITE</span><span class="p">()</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szFile</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">struct.ini&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szSection</span> <span class="o">=</span> <span class="s1">&#39;CLOSE_QUERY&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szKey</span> <span class="o">=</span> <span class="s1">&#39;TIME&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">lLen</span> <span class="o">=</span> <span class="mi">64</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">readStruct</span><span class="p">(</span><span class="n">inirw</span><span class="p">)</span>
<span class="n">info</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;info.szFile=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">szFile</span><span class="p">,</span> <span class="s1">&#39;|info.szSection=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">szSection</span><span class="p">,</span> <span class="s1">&#39;|info.szKey=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">szKey</span><span class="p">,</span>
      <span class="s1">&#39;|info.lLen=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">lLen</span><span class="p">,</span> <span class="s1">&#39;|info.pData=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">pData</span><span class="p">)</span>
<span class="c1">#info.szFile= E:\Test\struct.ini |info.szSection= CLOSE_QUERY |info.szKey= TIME |info.lLen= 24 |info.pData= 4567abcdefgh</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.writeStruct">
<code class="sig-name descname">writeStruct</code><span class="sig-paren">(</span><em class="sig-param">inirw</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.writeStruct" title="永久链接至目标">¶</a></dt>
<dd><p>向服务器上的一个INI文件写数据结构.其意义类似于Windows API: WritePrivateProfileStruc</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>inirw</strong> – 文件信息.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">inirw</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_INI_READWRITE</span><span class="p">()</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szFile</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">struct.ini&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szSection</span> <span class="o">=</span> <span class="s1">&#39;CLOSE_QUERY&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szKey</span> <span class="o">=</span> <span class="s1">&#39;TIME&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">pData</span> <span class="o">=</span> <span class="s1">&#39;123abcdefg&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">lLen</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">inirw</span><span class="o">.</span><span class="n">pData</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">writeStruct</span><span class="p">(</span><span class="n">inirw</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;write struct:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#write struct: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.readString">
<code class="sig-name descname">readString</code><span class="sig-paren">(</span><em class="sig-param">inirw</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.readString" title="永久链接至目标">¶</a></dt>
<dd><p>从服务器上的一个INI文件读字符串.其意义类似于Windows API: GetPrivateProfileString</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>inirw</strong> – 文件信息.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,文件信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">inirw</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_INI_READWRITE</span><span class="p">()</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szFile</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">string.ini&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szSection</span> <span class="o">=</span> <span class="s1">&#39;CLOSE_QUERY&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szKey</span> <span class="o">=</span> <span class="s1">&#39;TIME&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">lLen</span> <span class="o">=</span> <span class="mi">64</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">readString</span><span class="p">(</span><span class="n">inirw</span><span class="p">)</span>
<span class="n">info</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;info.szFile=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">szFile</span><span class="p">,</span> <span class="s1">&#39;|info.szSection=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">szSection</span><span class="p">,</span> <span class="s1">&#39;|info.szKey=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">szKey</span><span class="p">,</span>
      <span class="s1">&#39;|info.lLen=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">lLen</span><span class="p">,</span> <span class="s1">&#39;|info.pData=&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">.</span><span class="n">pData</span><span class="p">)</span>
<span class="c1">#info.szFile= E:\Test\string.ini |info.szSection= CLOSE_QUERY |info.szKey= TIME |info.lLen= 24 |info.pData= 4567abcdefgh</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.writeString">
<code class="sig-name descname">writeString</code><span class="sig-paren">(</span><em class="sig-param">inirw</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.writeString" title="永久链接至目标">¶</a></dt>
<dd><p>向服务器上的一个INI文件写字符串.其意义类似于Windows API: WritePrivateProfileString</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>inirw</strong> – 文件信息.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">inirw</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_INI_READWRITE</span><span class="p">()</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szFile</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">string.ini&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szSection</span> <span class="o">=</span> <span class="s1">&#39;CLOSE_QUERY&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">szKey</span> <span class="o">=</span> <span class="s1">&#39;TIME&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">pData</span> <span class="o">=</span> <span class="s1">&#39;4567abcdefgh&#39;</span>
<span class="n">inirw</span><span class="o">.</span><span class="n">lLen</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">inirw</span><span class="o">.</span><span class="n">pData</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">writeString</span><span class="p">(</span><span class="n">inirw</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;write string:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#write string: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.appentRecText">
<code class="sig-name descname">appentRecText</code><span class="sig-paren">(</span><em class="sig-param">tablename</em>, <em class="sig-param">packfile</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.appentRecText" title="永久链接至目标">¶</a></dt>
<dd><p>用REC文件批量增加记录</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名.</p></li>
<li><p><strong>packfile</strong> – rec数据文件名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">appentRecText</span><span class="p">(</span><span class="s1">&#39;TestTable&#39;</span><span class="p">,</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">FileAppendTable.txt&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;appent rec text:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#appent rec text: 8865</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.addRecData">
<code class="sig-name descname">addRecData</code><span class="sig-paren">(</span><em class="sig-param">addrecinfo</em><span class="optional">[</span>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.addRecData" title="永久链接至目标">¶</a></dt>
<dd><p>批处理增加记录文本</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>addrecinfo</strong> – 追加记录信息.</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">addrec</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_ADD_RECORD</span><span class="p">()</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">szTableName</span> <span class="o">=</span> <span class="s1">&#39;TestTable&#39;</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">pRecordBuf</span> <span class="o">=</span> <span class="s1">&#39;&lt;REC&gt;&lt;ID&gt;=997&lt;Name&gt;=zz&lt;Age&gt;=20&#39;</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">lDataLen</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">addrec</span><span class="o">.</span><span class="n">pRecordBuf</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">addRecData</span><span class="p">(</span><span class="n">addrec</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;add rec data:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#add rec data: 693</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.appentStart">
<code class="sig-name descname">appentStart</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.appentStart" title="永久链接至目标">¶</a></dt>
<dd><p>批处理增加记录的开始处理</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">addrec</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_ADD_RECORD</span><span class="p">()</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">szTableName</span> <span class="o">=</span> <span class="s1">&#39;TestTable&#39;</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">pRecordBuf</span> <span class="o">=</span> <span class="s1">&#39;&lt;REC&gt;&lt;ID&gt;=989&lt;Name&gt;=aa&lt;Age&gt;=16&#39;</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">lDataLen</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">addrec</span><span class="o">.</span><span class="n">pRecordBuf</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">appentStart</span><span class="p">(</span><span class="s1">&#39;TestTable&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;appent start:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#appent start: 0</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">appentTable</span><span class="p">(</span><span class="n">addrec</span><span class="p">)</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">appentEnd</span><span class="p">(</span><span class="s1">&#39;TestTable&#39;</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.appentTable">
<code class="sig-name descname">appentTable</code><span class="sig-paren">(</span><em class="sig-param">addrecinfo</em><span class="optional">[</span>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.appentTable" title="永久链接至目标">¶</a></dt>
<dd><p>批处理增加记录</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>addrecinfo</strong> – 追加记录信息.</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">addrec</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_ADD_RECORD</span><span class="p">()</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">szTableName</span> <span class="o">=</span> <span class="s1">&#39;TestTable&#39;</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">pRecordBuf</span> <span class="o">=</span> <span class="s1">&#39;&lt;REC&gt;&lt;ID&gt;=988&lt;Name&gt;=bb&lt;Age&gt;=15&#39;</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">lDataLen</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">addrec</span><span class="o">.</span><span class="n">pRecordBuf</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">appentStart</span><span class="p">(</span><span class="s1">&#39;TestTable&#39;</span><span class="p">)</span>  
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">appentTable</span><span class="p">(</span><span class="n">addrec</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;appent table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#appent table: 697</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">appentEnd</span><span class="p">(</span><span class="s1">&#39;TestTable&#39;</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.appentEnd">
<code class="sig-name descname">appentEnd</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.appentEnd" title="永久链接至目标">¶</a></dt>
<dd><p>批处理增加记录的结束</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">addrec</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_ADD_RECORD</span><span class="p">()</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">szTableName</span> <span class="o">=</span> <span class="s1">&#39;TestTable&#39;</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">pRecordBuf</span> <span class="o">=</span> <span class="s1">&#39;&lt;REC&gt;&lt;ID&gt;=987&lt;Name&gt;=cc&lt;Age&gt;=14&#39;</span>
<span class="n">addrec</span><span class="o">.</span><span class="n">lDataLen</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">addrec</span><span class="o">.</span><span class="n">pRecordBuf</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">appentStart</span><span class="p">(</span><span class="s1">&#39;TestTable&#39;</span><span class="p">)</span>  
<span class="n">tpiclient</span><span class="o">.</span><span class="n">appentTable</span><span class="p">(</span><span class="n">addrec</span><span class="p">)</span>   
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">appentEnd</span><span class="p">(</span><span class="s1">&#39;TestTable&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;appent end:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#appent end: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.readFile">
<code class="sig-name descname">readFile</code><span class="sig-paren">(</span><em class="sig-param">srcfile</em>, <em class="sig-param">destfile</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.readFile" title="永久链接至目标">¶</a></dt>
<dd><p>下载文件.从服务器上读取一个文件，然后写在本地的一个文件上</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>srcfile</strong> – 服务器原文件名.</p></li>
<li><p><strong>destfile</strong> – 本地目标文件名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">srcfile</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">src</span><span class="se">\\</span><span class="s1">test1.txt&#39;</span>
<span class="n">destfile</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">dest</span><span class="se">\\</span><span class="s1">test1.txt&#39;</span> 
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">readFile</span><span class="p">(</span><span class="n">srcfile</span><span class="p">,</span> <span class="n">destfile</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;read file:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#read file: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.writeFile">
<code class="sig-name descname">writeFile</code><span class="sig-paren">(</span><em class="sig-param">srcfile</em>, <em class="sig-param">destfile</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.writeFile" title="永久链接至目标">¶</a></dt>
<dd><p>上传文件.读取本地的一个文件，往服务器上写一个文件</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>srcfile</strong> – 本地数据文件名.</p></li>
<li><p><strong>destfile</strong> – 服务器目标文件名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">srcfile</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">src</span><span class="se">\\</span><span class="s1">test2.txt&#39;</span>
<span class="n">destfile</span> <span class="o">=</span> <span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">dest</span><span class="se">\\</span><span class="s1">test2.txt&#39;</span> 
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">writeFile</span><span class="p">(</span><span class="n">srcfile</span><span class="p">,</span> <span class="n">destfile</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;write file:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#write file: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.clearTableByName">
<code class="sig-name descname">clearTableByName</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.clearTableByName" title="永久链接至目标">¶</a></dt>
<dd><p>清空表的数据.危险操作，清空表后，所有数据和索引都不复存在</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">clearTableByName</span><span class="p">(</span><span class="s2">&quot;TestTable1&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;clear table by name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#clear table by name: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.closeTable">
<code class="sig-name descname">closeTable</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.closeTable" title="永久链接至目标">¶</a></dt>
<dd><p>关闭一个表.关闭表后,该表将从服务器中删除,但可以通过调用TPI_OpenTable恢复</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,服务器详细信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">openTable</span><span class="p">(</span><span class="s2">&quot;TestTable&quot;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">closeTable</span><span class="p">(</span><span class="s2">&quot;TestTable&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;close table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#close table: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.openTable">
<code class="sig-name descname">openTable</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.openTable" title="永久链接至目标">¶</a></dt>
<dd><p>打开一个表.服务器启动后当前全部表为打开状态,因此调用此接口将失败;因此此接口一般是和TPI_CloseTable配合调用,即打开已关闭的表以便能够访问</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">importTable</span><span class="p">(</span><span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">table</span><span class="se">\\</span><span class="s1">TestTable.dev&#39;</span><span class="p">)</span>
<span class="n">tpiclient</span><span class="o">.</span><span class="n">closeTable</span><span class="p">(</span><span class="s2">&quot;TestTable&quot;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openTable</span><span class="p">(</span><span class="s2">&quot;TestTable&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;open table:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#open table: 46</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.bulkSetRecord">
<code class="sig-name descname">bulkSetRecord</code><span class="sig-paren">(</span><em class="sig-param">bulksetrec</em>, <em class="sig-param">col</em>, <em class="sig-param">data</em><span class="optional">[</span>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.bulkSetRecord" title="永久链接至目标">¶</a></dt>
<dd><p>修改一列的字段值</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bulksetrec</strong> – 指定结果集(多行).</p></li>
<li><p><strong>col</strong> – 指定列号.</p></li>
<li><p><strong>data</strong> – 设定值.</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TestTable&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">recset</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getRecordSet</span><span class="p">()</span>
    <span class="n">bulksetrec</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_BULK_SET_RECORD</span><span class="p">()</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">hQuery</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_Query</span><span class="p">()</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">hQuery</span> <span class="o">=</span> <span class="n">recset</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">hQuery</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">vRow</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_VAR_LONGS</span><span class="p">()</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">vRow</span><span class="o">.</span><span class="n">lCount</span> <span class="o">=</span> <span class="mi">2</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">vRow</span><span class="o">.</span><span class="n">lData</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
    <span class="n">data</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_DATA</span><span class="p">()</span>
    <span class="n">data</span><span class="o">.</span><span class="n">pData</span> <span class="o">=</span> <span class="s1">&#39;abcde&#39;</span>
    <span class="n">data</span><span class="o">.</span><span class="n">lSize</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">pData</span><span class="p">)</span> <span class="o">*</span> <span class="mi">2</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">bulkSetRecord</span><span class="p">(</span><span class="n">bulksetrec</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;bulk set record:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#bulk set record: 0</span>
   
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.bulkSetRecordEx">
<code class="sig-name descname">bulkSetRecordEx</code><span class="sig-paren">(</span><em class="sig-param">bulksetrec</em>, <em class="sig-param">cols</em>, <em class="sig-param">data</em><span class="optional">[</span>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.bulkSetRecordEx" title="永久链接至目标">¶</a></dt>
<dd><p>修改多列的字段值</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bulksetrec</strong> – 指定结果集(多行).</p></li>
<li><p><strong>cols</strong> – 指定列号.</p></li>
<li><p><strong>data</strong> – 设定值.</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">recset</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getRecordSet</span><span class="p">()</span>
    <span class="n">bulksetrec</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_BULK_SET_RECORD</span><span class="p">()</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">hQuery</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_Query</span><span class="p">()</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">hQuery</span> <span class="o">=</span> <span class="n">recset</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">hQuery</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">vRow</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_VAR_LONGS</span><span class="p">()</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">vRow</span><span class="o">.</span><span class="n">lCount</span> <span class="o">=</span> <span class="mi">4</span>
    <span class="n">bulksetrec</span><span class="o">.</span><span class="n">vRow</span><span class="o">.</span><span class="n">lData</span> <span class="o">=</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
    <span class="n">col</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_VAR_LONGS</span><span class="p">()</span>
    <span class="n">col</span><span class="o">.</span><span class="n">lCount</span> <span class="o">=</span> <span class="mi">2</span>
    <span class="n">col</span><span class="o">.</span><span class="n">lData</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
    <span class="n">data</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_DATA</span><span class="p">()</span>
    <span class="n">data</span><span class="o">.</span><span class="n">pData</span> <span class="o">=</span> <span class="s1">&#39;&lt;HTB&gt;abdcdef&lt;/HTB&gt;&lt;HTB&gt;19&lt;/HTB&gt;&#39;</span>
    <span class="n">data</span><span class="o">.</span><span class="n">lSize</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">pData</span><span class="p">)</span> <span class="o">*</span> <span class="mi">2</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">bulkSetRecordEx</span><span class="p">(</span><span class="n">bulksetrec</span><span class="p">,</span> <span class="n">col</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;bulk set record ex:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#bulk set record ex: 0</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.lockQuery">
<code class="sig-name descname">lockQuery</code><span class="sig-paren">(</span><em class="sig-param">lockflag</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.lockQuery" title="永久链接至目标">¶</a></dt>
<dd><p>给记录集加解锁</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>lockflag</strong> – 加锁解锁标识.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">lockQuery</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;lock query:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#lock query: 0</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">lockQuery</span><span class="p">(</span><span class="kc">False</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;lock query:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#lock query: 0</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.wordSegment">
<code class="sig-name descname">wordSegment</code><span class="sig-paren">(</span><em class="sig-param">srcbuf</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.wordSegment" title="永久链接至目标">¶</a></dt>
<dd><p>分词</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>srcbuf</strong> – 分词内容.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,分词结果)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="c1">#conn = KBase.connect()</span>
<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s2">&quot;192.168.100.244&quot;</span><span class="p">,</span><span class="mi">4567</span><span class="p">,</span><span class="s2">&quot;DBOWN&quot;</span><span class="p">,</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="c1">#conn = KBase.connect(&quot;127.0.0.1&quot;,4567,&quot;DBOWN&quot;,&quot;&quot;)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;hcon = &#39;</span><span class="p">,</span> <span class="n">conn</span><span class="o">.</span><span class="n">hcon</span><span class="p">)</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">srcbuf</span> <span class="o">=</span> <span class="s1">&#39;我是中国人民的儿子，我深爱着我的祖国和人民&#39;</span>
<span class="c1">#srcbuf = &#39;旧路拓宽时软土地基处理技术研究&#39;</span>
<span class="c1">#srcbuf = &#39;市场结构、环境税与福利效应分析&#39;</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">wordSegment</span><span class="p">(</span><span class="n">srcbuf</span><span class="p">)</span>

<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;word segment:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#word segment: /我/是/中国/人民/的/儿子/，/我/深/爱/着/我/的/祖国/和/人民</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setRecordCount">
<code class="sig-name descname">setRecordCount</code><span class="sig-paren">(</span><em class="sig-param">count</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setRecordCount" title="永久链接至目标">¶</a></dt>
<dd><p>设定记录集缓冲大小</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>count</strong> – 缓冲记录数.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">setRecordCount</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;set record count:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#set record count: 100</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.clientCmd">
<code class="sig-name descname">clientCmd</code><span class="sig-paren">(</span><em class="sig-param">cmd</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.clientCmd" title="永久链接至目标">¶</a></dt>
<dd><p>软件注册相关的调用</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>cmd</strong> – 命令串.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,结果串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.reloadDict">
<code class="sig-name descname">reloadDict</code><span class="sig-paren">(</span><em class="sig-param">dictname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.reloadDict" title="永久链接至目标">¶</a></dt>
<dd><p>加载分词字典</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dictname</strong> – 词典名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">reloadDict</span><span class="p">(</span><span class="s1">&#39;E:</span><span class="se">\\</span><span class="s1">Test</span><span class="se">\\</span><span class="s1">dict</span><span class="se">\\</span><span class="s1">DicTest.sysdict&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;reload dict:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#reload dict: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.KEGetDicts">
<code class="sig-name descname">KEGetDicts</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.KEGetDicts" title="永久链接至目标">¶</a></dt>
<dd><p>取可用的字典名</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,XML格式所有词典名)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">KEGetDicts</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;KE get dicts:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">&#39;|&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#KE get dicts: 0 | &lt;dics&gt;&lt;/dics&gt;</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldTypeNameBySN">
<code class="sig-name descname">getFieldTypeNameBySN</code><span class="sig-paren">(</span><em class="sig-param">fieldno</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldTypeNameBySN" title="永久链接至目标">¶</a></dt>
<dd><p>根据字段类型编号取得字段类型名称</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldno</strong> – 字段类型号.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,字段类型名)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getFieldTypeNameBySN</span><span class="p">(</span><span class="mi">1024</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;field type name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#field type name: INTEGER</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getSNByFieldTypeName">
<code class="sig-name descname">getSNByFieldTypeName</code><span class="sig-paren">(</span><em class="sig-param">fieldname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getSNByFieldTypeName" title="永久链接至目标">¶</a></dt>
<dd><p>根据字段类型名称取得字段类型的编号</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldname</strong> – 字段类型名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getSNByFieldTypeName</span><span class="p">(</span><span class="s1">&#39;INTEGER&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get sn by field type name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get sn by field type name: 1024</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getIndexTypeNameBySN">
<code class="sig-name descname">getIndexTypeNameBySN</code><span class="sig-paren">(</span><em class="sig-param">indexno</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getIndexTypeNameBySN" title="永久链接至目标">¶</a></dt>
<dd><p>根据字段索引类型号编号取得字段索引类型名称</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>indexno</strong> – 字段索引类型号.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,字段索引类型名)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getIndexTypeNameBySN</span><span class="p">(</span><span class="mi">2049</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;index type name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#index type name: INTEGER</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getSNByIndexTypeName">
<code class="sig-name descname">getSNByIndexTypeName</code><span class="sig-paren">(</span><em class="sig-param">indexname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getSNByIndexTypeName" title="永久链接至目标">¶</a></dt>
<dd><p>根据字段索引类型名称取得字段索引类型号编号</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>indexname</strong> – 字段索引类型名.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getSNByIndexTypeName</span><span class="p">(</span><span class="s1">&#39;INTEGER&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get sn by index type name:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get sn by index type name: 2049</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.USPSetReplaceUrl">
<code class="sig-name descname">USPSetReplaceUrl</code><span class="sig-paren">(</span><em class="sig-param">url</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.USPSetReplaceUrl" title="永久链接至目标">¶</a></dt>
<dd><p>建立与usp的连接</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>url</strong> – 连接地址.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.USPUrlGetContent">
<code class="sig-name descname">USPUrlGetContent</code><span class="sig-paren">(</span><em class="sig-param">tablename</em>, <em class="sig-param">search</em>, <em class="sig-param">resultid</em>, <em class="sig-param">urlid</em>, <em class="sig-param">type</em>, <em class="sig-param">offset</em><span class="optional">[</span>, <em class="sig-param">buflen</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.USPUrlGetContent" title="永久链接至目标">¶</a></dt>
<dd><p>取得USP表快照字段中某个链接的内容</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名称.</p></li>
<li><p><strong>search</strong> – 检索条件全文.</p></li>
<li><p><strong>resultid</strong> – 记录号.</p></li>
<li><p><strong>urlid</strong> – 链接号.</p></li>
<li><p><strong>type</strong> – 连接内容类型.</p></li>
<li><p><strong>offset</strong> – 内容偏移.</p></li>
<li><p><strong>buflen</strong> – 缓冲大小(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,结果缓冲)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getRelevantWords">
<code class="sig-name descname">getRelevantWords</code><span class="sig-paren">(</span><em class="sig-param">keyword</em>, <em class="sig-param">wordnum</em>, <em class="sig-param">seperatorchar</em>, <em class="sig-param">wordfreqfollowed</em><span class="optional">[</span>, <em class="sig-param">dbname</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getRelevantWords" title="永久链接至目标">¶</a></dt>
<dd><p>得到相似词列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>keyword</strong> – 输入关键词.</p></li>
<li><p><strong>wordnum</strong> – 最多返回相似词的数量.</p></li>
<li><p><strong>seperatorchar</strong> – 分隔符号.</p></li>
<li><p><strong>wordfreqfollowed</strong> – 是否输出词频信息.</p></li>
<li><p><strong>dbname</strong> – 检索数据库名(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,返回关键词)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from CJFD0608&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">keyword</span> <span class="o">=</span> <span class="s1">&#39;计算机&#39;</span>
    <span class="n">Max_Relevant_Word_Num</span> <span class="o">=</span> <span class="mi">32</span>
    <span class="n">SeperatorChar</span> <span class="o">=</span> <span class="s1">&#39;|&#39;</span>
    <span class="n">WordFreqFollowed</span> <span class="o">=</span> <span class="kc">True</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getRelevantWords</span><span class="p">(</span><span class="n">keyword</span><span class="p">,</span> <span class="n">Max_Relevant_Word_Num</span><span class="p">,</span> <span class="n">SeperatorChar</span><span class="p">,</span> <span class="n">WordFreqFollowed</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get relevant words:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="c1">#get relevant words: 电子计算机:76    1    1|电了计算机:73    1    1|数字计算机:73    1    1|计算机应用:55    1    1|计算机控制:55    1    1|多计算机    54    1|计算机科学:54    1    1|计算机信息:54    1    1|计算机领域:53    1    1|计算机教育:53    1    1|计算机名    53    1|计算机管理:52    1    1|计算机培养:52    1    1|计算机部门:52    1    1|计算机软件:52    1    1|计算机基础    51    1|计算机学习:51    1    1|计算机指令系统:0    1    1|数字控制计算机:0    1    1|电脑    0    1</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getRecordRelevant">
<code class="sig-name descname">getRecordRelevant</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getRecordRelevant" title="永久链接至目标">¶</a></dt>
<dd><p>记录命中频度(可与相似检索配套使用)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>None</strong> – 无.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from TABLE1&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getRecordRelevant</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;get record relevant:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#get record relevant: 1</span>

    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getQuerySQL">
<code class="sig-name descname">getQuerySQL</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getQuerySQL" title="永久链接至目标">¶</a></dt>
<dd><p>得到记录集的查询语句</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,查询SQL语句)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">openRecordSet</span><span class="p">(</span><span class="s2">&quot;select * from CJFD0608 where 机构=&#39;清华大学&#39;&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">getQuerySQL</span><span class="p">()</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span><span class="c1">#(0, &quot;select * from CJFD0608 where 机构=&#39;清华大学&#39;&quot;)</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.TM_SimSearch">
<code class="sig-name descname">TM_SimSearch</code><span class="sig-paren">(</span><em class="sig-param">ksql</em>, <em class="sig-param">vsm</em><span class="optional">[</span>, <em class="sig-param">field</em>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.TM_SimSearch" title="永久链接至目标">¶</a></dt>
<dd><p>对vsm数据进行相似检索.将源vsm数据和表中记录的vsm数据进行匹配检索并按相关度排序</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ksql</strong> – KSQL语句或表名.</p></li>
<li><p><strong>vsm</strong> – VSM数据.</p></li>
<li><p><strong>field</strong> – 目标字段(可选)</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,游标对象)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">tablename</span> <span class="o">=</span> <span class="s1">&#39;SYS_DICT_RELEVANT</span><span class="se">\0</span><span class="s1">&#39;</span>
<span class="n">queryvsm</span> <span class="o">=</span> <span class="s1">&#39;陈独秀:9953,讨论会:440,社科院:426,新文化运动:392,安徽:309,文化:264&#39;</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">TM_SimSearch</span><span class="p">(</span><span class="n">tablename</span><span class="p">,</span> <span class="n">queryvsm</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
    <span class="n">cur</span> <span class="o">=</span> <span class="n">ret</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
    <span class="n">tpiclient</span><span class="o">.</span><span class="n">setCursor</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;TM sim search:&#39;</span><span class="p">,</span> <span class="n">cur</span><span class="o">.</span><span class="n">hSet</span><span class="p">)</span><span class="c1">#TM sim search: 1025</span>
    
    <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.TM_LoadDict">
<code class="sig-name descname">TM_LoadDict</code><span class="sig-paren">(</span><em class="sig-param">dicttable</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.TM_LoadDict" title="永久链接至目标">¶</a></dt>
<dd><p>加载词典(使用前需要启动文本挖掘引擎)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dicttable</strong> – 词典在HotStar中表名</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">hdict</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">TM_LoadDict</span><span class="p">(</span><span class="s1">&#39;foreign_dic&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;TM load dict:&#39;</span><span class="p">,</span> <span class="n">hdict</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#TM load dict: 2</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.TM_UnLoadDict">
<code class="sig-name descname">TM_UnLoadDict</code><span class="sig-paren">(</span><em class="sig-param">dicthandle</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.TM_UnLoadDict" title="永久链接至目标">¶</a></dt>
<dd><p>卸载词典(使用前需要启动文本挖掘引擎)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dicthandle</strong> – 词典句柄.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">hdict</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">TM_LoadDict</span><span class="p">(</span><span class="s1">&#39;foreign_dic&#39;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">TM_UnLoadDict</span><span class="p">(</span><span class="n">hdict</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;TM unload dict:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> 

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.TM_GetDictHandle">
<code class="sig-name descname">TM_GetDictHandle</code><span class="sig-paren">(</span><em class="sig-param">dicttable</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.TM_GetDictHandle" title="永久链接至目标">¶</a></dt>
<dd><p>获得词典句柄</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dicttable</strong> – 词典在HotStar中表名(多个表名用”,”分隔).</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">TM_GetDictHandle</span><span class="p">(</span><span class="s1">&#39;sys_general_dic&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;TM get dict handle:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#TM get dict handle: 5</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.TM_DeleteDictHandle">
<code class="sig-name descname">TM_DeleteDictHandle</code><span class="sig-paren">(</span><em class="sig-param">dicthandle</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.TM_DeleteDictHandle" title="永久链接至目标">¶</a></dt>
<dd><p>删除词典句柄</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dicthandle</strong> – 词典句柄.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">handle</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">TM_GetDictHandle</span><span class="p">(</span><span class="s1">&#39;sys_general_dic&#39;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">tpiclient</span><span class="o">.</span><span class="n">TM_DeleteDictHandle</span><span class="p">(</span><span class="n">handle</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;TM delete dict handle:&#39;</span><span class="p">,</span> <span class="n">ret</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="c1">#TM delete dict handle: 0</span>

<span class="n">conn</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableHandle">
<code class="sig-name descname">getTableHandle</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableHandle" title="永久链接至目标">¶</a></dt>
<dd><p>获取表句柄</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|表句柄,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTableHandle</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span> <span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from &quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">hTable</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableHandle</span><span class="p">()</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableType">
<code class="sig-name descname">getTableType</code><span class="sig-paren">(</span><em class="sig-param">htable</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableType" title="永久链接至目标">¶</a></dt>
<dd><p>获取表类型</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>htable</strong> – 表句柄</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|表句柄,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTableType</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from &quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">hTable</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableHandle</span><span class="p">()</span>
<span class="n">nType</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableType</span><span class="p">(</span><span class="n">hTable</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableHitCount">
<code class="sig-name descname">getTableHitCount</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableHitCount" title="永久链接至目标">¶</a></dt>
<dd><p>获取表记录数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|表记录数,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTableHitCount</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableHitCount</span><span class="p">(</span><span class="n">sTableName</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableHostIP">
<code class="sig-name descname">getTableHostIP</code><span class="sig-paren">(</span><em class="sig-param">htable</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableHostIP" title="永久链接至目标">¶</a></dt>
<dd><p>获取主机IP</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>htable</strong> – 表句柄</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,Ip字符串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTableHostIP</span>

<span class="kn">import</span> <span class="nn">KBase</span>


<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from &quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">hTable</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableHandle</span><span class="p">()</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sIp</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableHostIP</span><span class="p">(</span><span class="n">hTable</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getDatabaseCount">
<code class="sig-name descname">getDatabaseCount</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getDatabaseCount" title="永久链接至目标">¶</a></dt>
<dd><p>获取数据库数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|数据库数,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getDatabaseCount</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getDatabaseCount</span><span class="p">()</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getDatabaseName">
<code class="sig-name descname">getDatabaseName</code><span class="sig-paren">(</span><em class="sig-param">dbindex</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getDatabaseName" title="永久链接至目标">¶</a></dt>
<dd><p>获取指定数据库名称</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dbindex</strong> – 数据库索引</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,数据库名称)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getDatabaseName</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getDatabaseCount</span><span class="p">()</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nCount</span><span class="p">):</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="n">sName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getDatabaseName</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getAllDatabaseName">
<code class="sig-name descname">getAllDatabaseName</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getAllDatabaseName" title="永久链接至目标">¶</a></dt>
<dd><p>获取数据库名称列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,数据库名称列表)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getAllDatabaseName</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span> 
<span class="n">nErr</span><span class="p">,</span> <span class="n">sNames</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getAllDatabaseName</span><span class="p">()</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTablesListInDB">
<code class="sig-name descname">getTablesListInDB</code><span class="sig-paren">(</span><em class="sig-param">dbname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTablesListInDB" title="永久链接至目标">¶</a></dt>
<dd><p>得到数据库的表名称列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dbname</strong> – 数据库名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,表名称列表字符串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTablesListInDBEx</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="p">(</span><span class="n">nDBCount</span><span class="p">,</span> <span class="p">)</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getDatabaseCount</span><span class="p">()</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nDBCount</span><span class="p">):</span>
        <span class="n">nErrCode</span><span class="p">,</span> <span class="n">sDBName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getDatabaseName</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;sDBName = &quot;</span><span class="p">,</span> <span class="n">sDBName</span><span class="p">)</span>
        <span class="n">nErr</span><span class="p">,</span> <span class="n">sTableList</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTablesListInDB</span><span class="p">(</span><span class="n">sDBName</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;    sTableList = &quot;</span><span class="p">,</span> <span class="n">sTableList</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableInfoFromCache">
<code class="sig-name descname">getTableInfoFromCache</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableInfoFromCache" title="永久链接至目标">¶</a></dt>
<dd><p>获取表信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,TPI_TABLE_INFO)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTableInfoFromCache</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">tableInfo</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableInfoFromCache</span><span class="p">(</span><span class="n">ssTableName</span><span class="p">)</span>

<span class="n">tableHead</span> <span class="o">=</span> <span class="n">tableInfo</span><span class="o">.</span><span class="n">TableHead</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;type(tableHead) = &quot;</span><span class="p">,</span> <span class="nb">type</span><span class="p">(</span><span class="n">tableHead</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;TableName = &quot;</span><span class="p">,</span> <span class="n">tableHead</span><span class="o">.</span><span class="n">tableName</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;createTime = &quot;</span><span class="p">,</span> <span class="n">tableHead</span><span class="o">.</span><span class="n">createTime</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;modifyTime = &quot;</span><span class="p">,</span> <span class="n">tableHead</span><span class="o">.</span><span class="n">modifyTime</span><span class="p">)</span>
    
<span class="n">fieldInfo</span> <span class="o">=</span> <span class="n">tableInfo</span><span class="o">.</span><span class="n">TableField</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;type(fieldInfo) = &quot;</span><span class="p">,</span> <span class="nb">type</span><span class="p">(</span><span class="n">fieldInfo</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;type(fieldInfo[0]) = &quot;</span><span class="p">,</span> <span class="nb">type</span><span class="p">(</span><span class="n">fieldInfo</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;FieldCount = &quot;</span><span class="p">,</span> <span class="n">tableInfo</span><span class="o">.</span><span class="n">TableHead</span><span class="o">.</span><span class="n">fieldNum</span><span class="p">)</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">fieldInfo</span><span class="p">)):</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;name = &quot;</span><span class="p">,</span><span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;aliasName = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">aliasName</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;dispName = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">dispName</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;code = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">code</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;data = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;index = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">index</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;specProperty = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">specProperty</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;modifiedCount = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">modifiedCount</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;lastIndexRec = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">lastIndexRec</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;type = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;len = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">len</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;fieldOffset = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">fieldOffset</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;indexkeyLen = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">indexkeyLen</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;indexType = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">indexType</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;indexProperty = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">indexProperty</span><span class="p">,</span> <span class="n">end</span> <span class="o">=</span> <span class="s2">&quot; ,  &quot;</span><span class="p">)</span>
	<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;indexRootBlkNo = &quot;</span><span class="p">,</span> <span class="n">fieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">indexRootBlkNo</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getViewIndex">
<code class="sig-name descname">getViewIndex</code><span class="sig-paren">(</span><em class="sig-param">viewname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getViewIndex" title="永久链接至目标">¶</a></dt>
<dd><p>获取视图序号</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>viewname</strong> – 视图名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|视图序号,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getViewIndex</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">viewNameExists</span><span class="p">(</span><span class="n">sViewName</span><span class="p">)</span>
<span class="k">if</span> <span class="n">nErr</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getViewIndex</span><span class="p">(</span><span class="n">sViewName</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldTypeList">
<code class="sig-name descname">getFieldTypeList</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldTypeList" title="永久链接至目标">¶</a></dt>
<dd><p>获取全部字段类型信息列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,字段类型信息列表)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getFieldTypeList</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sFieldTypeList</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getFieldTypeList</span><span class="p">()</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getIndexTypeList">
<code class="sig-name descname">getIndexTypeList</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getIndexTypeList" title="永久链接至目标">¶</a></dt>
<dd><p>获取全部索引类型信息列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,类型信息列表)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getIndexTypeList</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sIndexTypeList</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getIndexTypeList</span><span class="p">()</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getAllTableType">
<code class="sig-name descname">getAllTableType</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getAllTableType" title="永久链接至目标">¶</a></dt>
<dd><p>获取取当前用户具有权限的表的表名和类型信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,表名和类型信息字符串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getAllTableType</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sTableTypeList</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getAllTableType</span><span class="p">()</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getSysDbList">
<code class="sig-name descname">getSysDbList</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getSysDbList" title="永久链接至目标">¶</a></dt>
<dd><p>获取系统的数据库名称列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,数据库名称列表字符串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getSysDbList</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sysDBList</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getSysDbList</span><span class="p">()</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.queryEvent">
<code class="sig-name descname">queryEvent</code><span class="sig-paren">(</span><em class="sig-param">hevent</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.queryEvent" title="永久链接至目标">¶</a></dt>
<dd><p>查询事件是否完成</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>hevent</strong> – 事件句柄</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|事件完成标志,)</p>
</dd>
</dl>
<p>例:</p>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableHandle2">
<code class="sig-name descname">getTableHandle2</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableHandle2" title="永久链接至目标">¶</a></dt>
<dd><p>根据表名称获取表的句柄</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码|表的句柄,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTableHandle2</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">hTable</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableHandle2</span><span class="p">(</span><span class="n">sTableName</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getDBNameofTable">
<code class="sig-name descname">getDBNameofTable</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getDBNameofTable" title="永久链接至目标">¶</a></dt>
<dd><p>得到指定表所在的数据库</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,数据库名称)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getDBNameofTable</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sDBName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getDBNameofTable</span><span class="p">(</span><span class="n">sTableName</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getDBRight">
<code class="sig-name descname">getDBRight</code><span class="sig-paren">(</span><em class="sig-param">info</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getDBRight" title="永久链接至目标">¶</a></dt>
<dd><p>获取数据库的权限</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>info</strong> – KBase.TPI_ACCOUNT_DBRIGHT对象</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码权限值,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.vQExpandTo</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getDBField">
<code class="sig-name descname">getDBField</code><span class="sig-paren">(</span><em class="sig-param">ad</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getDBField" title="永久链接至目标">¶</a></dt>
<dd><p>获取数据库具体字段权限</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>ad</strong> – 账户数据库名称对象</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,字段权限字符串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getDBField</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">accDBName</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_ACCOUNT_DBNAME</span><span class="p">()</span>
<span class="n">accDBName</span><span class="o">.</span><span class="n">lUser</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">accDBName</span><span class="o">.</span><span class="n">szName</span> <span class="o">=</span> <span class="s2">&quot;DBOWN&quot;</span>
<span class="n">accDBName</span><span class="o">.</span><span class="n">szDbName</span> <span class="o">=</span> <span class="s2">&quot;PERSON&quot;</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sFieldRight</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getDBField</span><span class="p">(</span><span class="n">accDBName</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.createView">
<code class="sig-name descname">createView</code><span class="sig-paren">(</span><em class="sig-param">viewname</em>, <em class="sig-param">sql</em>, <em class="sig-param">modify</em><span class="optional">[</span>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.createView" title="永久链接至目标">¶</a></dt>
<dd><p>设置视图信息、修改视图或是新建视图</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>viewname</strong> – 视图名称</p></li>
<li><p><strong>sql</strong> – SQL语句</p></li>
<li><p><strong>modify</strong> – 修改视图还是新建视图标志</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.createView</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>   
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sTableName</span><span class="p">,)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">createView</span><span class="p">(</span><span class="n">sViewName</span><span class="p">,</span> <span class="n">s</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.deleteView">
<code class="sig-name descname">deleteView</code><span class="sig-paren">(</span><em class="sig-param">viewname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.deleteView" title="永久链接至目标">¶</a></dt>
<dd><p>删除视图</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>viewname</strong> – 视图名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.deleteView</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">deleteView</span><span class="p">(</span><span class="n">sViewName</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableCountEx">
<code class="sig-name descname">getTableCountEx</code><span class="sig-paren">(</span><em class="sig-param">type</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableCountEx" title="永久链接至目标">¶</a></dt>
<dd><p>得到指定类型表数量</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>type</strong> – 表类型</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码表数量,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTableCountEx</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="c1">#nTableType 表的类型  0x0000: 本地表, 0x0001:远程表, 0x0003: 与其它HotStar并行时之间的虚拟互连表, 0x0004: 异构表 </span>
<span class="c1">#0x0004: Z39.50虚拟表, #0x100: 本地表</span>
<span class="n">nErr</span><span class="p">,</span>  <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableCountEx</span><span class="p">(</span><span class="n">nTableType</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTablesQueryInDB">
<code class="sig-name descname">getTablesQueryInDB</code><span class="sig-paren">(</span><em class="sig-param">dbname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTablesQueryInDB" title="永久链接至目标">¶</a></dt>
<dd><p>获取指定数据的表名称记录集</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dbname</strong> – 数据库名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,游标对象)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTablesQueryInDB</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">cursor</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTablesQueryInDB</span><span class="p">(</span><span class="n">sDBName</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTableNameEx">
<code class="sig-name descname">getTableNameEx</code><span class="sig-paren">(</span><em class="sig-param">tableindex</em>, <em class="sig-param">type</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTableNameEx" title="永久链接至目标">¶</a></dt>
<dd><p>根据表的索引和类型得到表的名字</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tableindex</strong> – 表索引</p></li>
<li><p><strong>type</strong> – 表类型</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,表名称)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTableNameEx</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nCount</span><span class="p">,</span>  <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableCountEx</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nCount</span><span class="p">):</span>
    <span class="n">nErr</span><span class="p">,</span> <span class="n">sName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableNameEx</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">nTableType</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTablesFieldsList">
<code class="sig-name descname">getTablesFieldsList</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTablesFieldsList" title="永久链接至目标">¶</a></dt>
<dd><p>得到表名字段名列表的查询结果集</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,游标对象)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTablesFieldsList</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">cursor</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTablesFieldsList</span><span class="p">()</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.refreshTableInfo">
<code class="sig-name descname">refreshTableInfo</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.refreshTableInfo" title="永久链接至目标">¶</a></dt>
<dd><p>刷新指定表结构的指定缓存</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.refreshTableInfo</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">refreshTableInfo</span><span class="p">(</span><span class="n">sTableName</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.importTable2">
<code class="sig-name descname">importTable2</code><span class="sig-paren">(</span><em class="sig-param">path</em>, <em class="sig-param">dbname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.importTable2" title="永久链接至目标">¶</a></dt>
<dd><p>将指定表导入到指定的数据库中</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> – 表路径</p></li>
<li><p><strong>DBName</strong> – 数据库名称</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.importTable2</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">importTable2</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">%s%s</span><span class="s2">.dev&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">csTempPath</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">,),</span> <span class="n">sDBName</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.moveTable">
<code class="sig-name descname">moveTable</code><span class="sig-paren">(</span><em class="sig-param">tablename</em>, <em class="sig-param">dbname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.moveTable" title="永久链接至目标">¶</a></dt>
<dd><p>将指定的表移到指定的数据库中</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名称</p></li>
<li><p><strong>dbname</strong> – 数据库名称</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.moveTable</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">moveTable</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="n">sDstDBName</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getBLob">
<code class="sig-name descname">getBLob</code><span class="sig-paren">(</span><em class="sig-param">colno</em>, <em class="sig-param">offset</em>, <em class="sig-param">nread</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getBLob" title="永久链接至目标">¶</a></dt>
<dd><p>读取二进制字段值</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>colno</strong> – 列号</p></li>
<li><p><strong>offset</strong> – 偏移</p></li>
<li><p><strong>nread</strong> – 读取字节数</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,二进制字符串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getBLob</span>

<span class="kn">import</span> <span class="nn">KBase</span>
<span class="kn">import</span> <span class="nn">string</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">sSrc</span> <span class="o">=</span> <span class="n">string</span><span class="o">.</span><span class="n">ascii_lowercase</span>
<span class="n">bSrc</span> <span class="o">=</span> <span class="n">sSrc</span><span class="o">.</span><span class="n">encode</span><span class="p">()</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sBlobTableName</span><span class="p">,))</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setBLob</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">bSrc</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">bDest</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getBLob</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">bSrc</span><span class="p">))</span>
<span class="n">sDest</span> <span class="o">=</span> <span class="n">bDest</span><span class="o">.</span><span class="n">decode</span><span class="p">()</span>



</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setBLob">
<code class="sig-name descname">setBLob</code><span class="sig-paren">(</span><em class="sig-param">colno</em>, <em class="sig-param">type</em>, <em class="sig-param">binaryseries</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setBLob" title="永久链接至目标">¶</a></dt>
<dd><p>修改二进制字段值</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>colno</strong> – 列号</p></li>
<li><p><strong>type</strong> – 添加方式</p></li>
<li><p><strong>binaryseries</strong> – 二进制字符串对象</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.setBLob</span>

<span class="kn">import</span> <span class="nn">KBase</span>
<span class="kn">import</span> <span class="nn">string</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sBlobTableName</span><span class="p">,))</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">sSrc</span> <span class="o">=</span> <span class="n">string</span><span class="o">.</span><span class="n">ascii_lowercase</span>
<span class="n">bSrc</span> <span class="o">=</span> <span class="n">sSrc</span><span class="o">.</span><span class="n">encode</span><span class="p">()</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setBLob</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">bSrc</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.isEndPage">
<code class="sig-name descname">isEndPage</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.isEndPage" title="永久链接至目标">¶</a></dt>
<dd><p>是否是最后一页</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.isEndPage</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span><span class="p">,)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">isEndPage</span><span class="p">()</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.isSingleTableMode">
<code class="sig-name descname">isSingleTableMode</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.isSingleTableMode" title="永久链接至目标">¶</a></dt>
<dd><p>判断一个记录集是不是以单表形式打开</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,bool)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.isSingleTableMode</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from &quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">bIsSingleMode</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">isSingleTableMode</span><span class="p">()</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.createDataBase">
<code class="sig-name descname">createDataBase</code><span class="sig-paren">(</span><em class="sig-param">dbname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.createDataBase" title="永久链接至目标">¶</a></dt>
<dd><p>创建数据库</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dbname</strong> – 数据库名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.createDataBase</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">sDBNamePattern</span> <span class="o">=</span> <span class="s2">&quot;TESTCASE_DB</span><span class="si">%d</span><span class="s2">&quot;</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>    
<span class="n">nErr</span><span class="p">,</span>  <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">createDataBase</span><span class="p">(</span><span class="n">sDBName</span><span class="p">)</span>



</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getTablesListInDBEx">
<code class="sig-name descname">getTablesListInDBEx</code><span class="sig-paren">(</span><em class="sig-param">dbname</em><span class="optional">[</span>, <em class="sig-param">listtype</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getTablesListInDBEx" title="永久链接至目标">¶</a></dt>
<dd><p>得到数据库的表名称列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>dbname</strong> – 数据库名称</p></li>
<li><p><strong>listtype</strong> – [可选, 表类型=0]</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,表名称列表字符串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getTablesListInDBEx</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="p">(</span><span class="n">nDBCount</span><span class="p">,</span> <span class="p">)</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getDatabaseCount</span><span class="p">()</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nDBCount</span><span class="p">):</span>
        <span class="n">nErrCode</span><span class="p">,</span> <span class="n">sDBName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getDatabaseName</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;sDBName = &quot;</span><span class="p">,</span> <span class="n">sDBName</span><span class="p">)</span>
        <span class="n">nErr</span><span class="p">,</span> <span class="n">sTableList</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTablesListInDB</span><span class="p">(</span><span class="n">sDBName</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;    sTableList = &quot;</span><span class="p">,</span> <span class="n">sTableList</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setCacheFields">
<code class="sig-name descname">setCacheFields</code><span class="sig-paren">(</span><em class="sig-param">fieldlst</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setCacheFields" title="永久链接至目标">¶</a></dt>
<dd><p>设置缓存字段</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fieldlst</strong> – 字段列表</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.setCacheFields</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span><span class="p">,)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setCacheFields</span><span class="p">(</span><span class="s2">&quot;Name,Age&quot;</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getCacheFields">
<code class="sig-name descname">getCacheFields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getCacheFields" title="永久链接至目标">¶</a></dt>
<dd><p>获取当前结果集缓存字段</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码、字段列表缓冲区)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getCacheFields</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span><span class="p">,)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setCacheFields</span><span class="p">(</span><span class="s2">&quot;Name,Age&quot;</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sFieldCache</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getCacheFields</span><span class="p">()</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.refreshVQDataSet">
<code class="sig-name descname">refreshVQDataSet</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.refreshVQDataSet" title="永久链接至目标">¶</a></dt>
<dd><p>刷新跨库结果集</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.refreshVQDataSet</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;VARSELECT NAME,AGE FROM </span><span class="si">{0}</span><span class="s2">, </span><span class="si">{1}</span><span class="s2"> WITH MAINDB=(</span><span class="si">{0}</span><span class="s2">,</span><span class="si">{1}</span><span class="s2">), DUPDB=NULL, REFCOL=NULL &quot;</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="n">sSQL</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="n">sTableName2</span><span class="p">)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">refreshVQDataSet</span><span class="p">()</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getVQRecordCount">
<code class="sig-name descname">getVQRecordCount</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getVQRecordCount" title="永久链接至目标">¶</a></dt>
<dd><p>得到跨库结果集的记录数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码记录数)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getVQRecordCount</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;VARSELECT NAME,AGE FROM </span><span class="si">{0}</span><span class="s2">, </span><span class="si">{1}</span><span class="s2"> WITH MAINDB=(</span><span class="si">{0}</span><span class="s2">,</span><span class="si">{1}</span><span class="s2">), DUPDB=NULL, REFCOL=NULL &quot;</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="n">sSQL</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="n">sTableName2</span><span class="p">)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getVQRecordCount</span><span class="p">()</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getVQRecordCountByName">
<code class="sig-name descname">getVQRecordCountByName</code><span class="sig-paren">(</span><em class="sig-param">dbname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getVQRecordCountByName" title="永久链接至目标">¶</a></dt>
<dd><p>根据库名获得跨库记录集的结果数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dbname</strong> – 库名</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码结果数)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getVQRecordCountByName</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;VARSELECT NAME,AGE FROM </span><span class="si">{0}</span><span class="s2">, </span><span class="si">{1}</span><span class="s2"> WITH MAINDB=(</span><span class="si">{0}</span><span class="s2">,</span><span class="si">{1}</span><span class="s2">), DUPDB=NULL, REFCOL=NULL &quot;</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="n">sSQL</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="n">sTableName2</span><span class="p">)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span> 
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getVQRecordCountByName</span><span class="p">(</span><span class="n">sTableName</span><span class="p">)</span>
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getVQRecordCountByName</span><span class="p">(</span><span class="n">sTableName2</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getVQMaxRecordCount">
<code class="sig-name descname">getVQMaxRecordCount</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getVQMaxRecordCount" title="永久链接至目标">¶</a></dt>
<dd><p>获取变长查询(跨库记录集)的最大结果数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码最大结果数)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getVQMaxRecordCount</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;VARSELECT NAME,AGE FROM </span><span class="si">{0}</span><span class="s2">, </span><span class="si">{1}</span><span class="s2"> WITH MAINDB=(</span><span class="si">{0}</span><span class="s2">,</span><span class="si">{1}</span><span class="s2">), DUPDB=NULL, REFCOL=NULL &quot;</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="n">sSQL</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="n">sTableName2</span><span class="p">)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getVQMaxRecordCount</span><span class="p">()</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.vQExpandTo">
<code class="sig-name descname">vQExpandTo</code><span class="sig-paren">(</span><em class="sig-param">rowno</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.vQExpandTo" title="永久链接至目标">¶</a></dt>
<dd><p>将变长结果集翻页</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>rowno</strong> – 记录序号</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.vQExpandTo</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>

<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;VARSELECT NAME,AGE FROM </span><span class="si">{0}</span><span class="s2">, </span><span class="si">{1}</span><span class="s2"> WITH MAINDB=(</span><span class="si">{0}</span><span class="s2">,</span><span class="si">{1}</span><span class="s2">), DUPDB=NULL, REFCOL=NULL &quot;</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="n">sSQL</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sTableName2</span><span class="p">)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>

<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">vQExpandTo</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>

 
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getUserOfGroup">
<code class="sig-name descname">getUserOfGroup</code><span class="sig-paren">(</span><em class="sig-param">groupname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getUserOfGroup" title="永久链接至目标">¶</a></dt>
<dd><p>查询组中的用户</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>groupname</strong> – 组名</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,用户列表)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getUserOfGroup</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sGroup</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getGroupOfUser</span><span class="p">(</span><span class="s2">&quot;DBOWN&quot;</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sUser</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getUserOfGroup</span><span class="p">(</span><span class="n">sGroup</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getGroupOfUser">
<code class="sig-name descname">getGroupOfUser</code><span class="sig-paren">(</span><em class="sig-param">username</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getGroupOfUser" title="永久链接至目标">¶</a></dt>
<dd><p>查询用户所属的组</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>username</strong> – 用户名</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,组列表)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getGroupOfUser</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sGroup</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getGroupOfUser</span><span class="p">(</span><span class="s2">&quot;DBOWN&quot;</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.outputRecToText">
<code class="sig-name descname">outputRecToText</code><span class="sig-paren">(</span><em class="sig-param">recinfo</em>, <em class="sig-param">fieldlst</em><span class="optional">[</span>, <em class="sig-param">bunicode</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.outputRecToText" title="永久链接至目标">¶</a></dt>
<dd><p>将指定表的数据导出为REC文件</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>recinfo</strong> – TPI_FILE_REC_OUTPUT类对象</p></li>
<li><p><strong>fieldlst</strong> – 字段列表</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.outputRecToText</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
        
<span class="n">FileRec</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_FILE_REC_OUTPUT</span><span class="p">()</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">szTable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">szPackFile</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">%s%s</span><span class="s2">.txt&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">csTempPath</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">)</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">nStartRec</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">nEndRec</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">sqlWhere</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
<span class="n">field</span> <span class="o">=</span> <span class="s2">&quot;NAME, AGE&quot;</span>

<span class="n">hEvent</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">outputRecToText</span><span class="p">(</span><span class="n">FileRec</span><span class="p">,</span> <span class="n">field</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.createUnionTable">
<code class="sig-name descname">createUnionTable</code><span class="sig-paren">(</span><em class="sig-param">uniontablename</em>, <em class="sig-param">maintablename</em>, <em class="sig-param">subtables</em>, <em class="sig-param">uniontabledbname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.createUnionTable" title="永久链接至目标">¶</a></dt>
<dd><p>创建联合表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>uniontablename</strong> – 联合表名称</p></li>
<li><p><strong>maintablename</strong> – 主表名称</p></li>
<li><p><strong>subtables</strong> – 子表名称列表</p></li>
<li><p><strong>uniontabledbname</strong> – 联合表所属数据库名称</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.createUnionTable</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">sUnionTableName</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">_</span><span class="si">%s</span><span class="s2">_UNION&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="n">sTableName2</span><span class="p">)</span> 
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">createUnionTable</span><span class="p">(</span><span class="n">sUnionTableName</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">,</span> <span class="n">sTableName2</span><span class="p">,</span> <span class="n">sDBName</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getUnionTableInfo">
<code class="sig-name descname">getUnionTableInfo</code><span class="sig-paren">(</span><em class="sig-param">uniontablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getUnionTableInfo" title="永久链接至目标">¶</a></dt>
<dd><p>通过联合表的名称获取联合表的组成信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>uniontablename</strong> – 联合表名称</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,联合表组成信息)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getUnionTableInfo</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">unionTableInfo</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getUnionTableInfo</span><span class="p">(</span><span class="n">sUnionTableName</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;unionTableInfo = &quot;</span><span class="p">,</span> <span class="n">unionTableInfo</span><span class="p">)</span>


                


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.isRecordSetReadOnly">
<code class="sig-name descname">isRecordSetReadOnly</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.isRecordSetReadOnly" title="永久链接至目标">¶</a></dt>
<dd><p>判断一个记录集是不是只读</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,bool)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.isRecordSetReadOnly</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from &quot;</span> <span class="o">+</span> <span class="n">sTableName</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">bIsReadOnly</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">isRecordSetReadOnly</span><span class="p">()</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.reIndexTable">
<code class="sig-name descname">reIndexTable</code><span class="sig-paren">(</span><em class="sig-param">htable</em><span class="optional">[</span>, <em class="sig-param">startrec</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.reIndexTable" title="永久链接至目标">¶</a></dt>
<dd><p>重新索引表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>htable</strong> – 表句柄</p></li>
<li><p><strong>startrec</strong> – 起始记录序号</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.reIndexTable</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from person&quot;</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">hTable</span><span class="p">,</span>  <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getTableHandle</span><span class="p">()</span>
<span class="n">nErr</span><span class="p">,</span>  <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">reIndexTable</span><span class="p">(</span><span class="n">hTable</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldValueByXml">
<code class="sig-name descname">getFieldValueByXml</code><span class="sig-paren">(</span><em class="sig-param">startrec</em>, <em class="sig-param">endtrec</em>, <em class="sig-param">flag</em>, <em class="sig-param">fieldlst</em>, <em class="sig-param">contentlen</em>, <em class="sig-param">bunicode</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldValueByXml" title="永久链接至目标">¶</a></dt>
<dd><p>以XML形式批量返回记录内容</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>startrec</strong> – 起始记录</p></li>
<li><p><strong>endtrec</strong> – 终止记录</p></li>
<li><p><strong>flag</strong> – 字段名或者字段序号</p></li>
<li><p><strong>fieldlst</strong> – 字段名称或序号的组合串</p></li>
<li><p><strong>contentlen</strong> – 相应字段需要取出内容的长度</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,记录字符串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getFieldValueByXml</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">sFields</span> <span class="o">=</span> <span class="s2">&quot;NAME,AGE&quot;</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sXml</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getFieldValueByXml</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">sFields</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getXmlRecordByMultiSQL">
<code class="sig-name descname">getXmlRecordByMultiSQL</code><span class="sig-paren">(</span><em class="sig-param">sqls</em>, <em class="sig-param">count</em>, <em class="sig-param">prefix</em>, <em class="sig-param">postfix</em>, <em class="sig-param">bunicode</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getXmlRecordByMultiSQL" title="永久链接至目标">¶</a></dt>
<dd><p>以XML形式批量返回指定的SQL集合的记录内容</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sqls</strong> – SQL语句集</p></li>
<li><p><strong>count</strong> – 每个SQL返回的记录数</p></li>
<li><p><strong>prefix</strong> – 标红前缀</p></li>
<li><p><strong>postfix</strong> – 标红后缀</p></li>
<li><p><strong>bunicode</strong> – 字段是否全部为unicode编码(可选).</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,集合记录内容)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getXmlRecordByMultiSQL</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sTableName</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sXml</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getXmlRecordByMultiSQL</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.clusterGetActiveNodes">
<code class="sig-name descname">clusterGetActiveNodes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.clusterGetActiveNodes" title="永久链接至目标">¶</a></dt>
<dd><p>得到集群中激活的节点</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,激活的节点)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.clusterGetActiveNodes</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;DBUM set CLUSTERENABLE ON&quot;</span>
<span class="n">hEvent</span><span class="p">,</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="o">.</span><span class="n">execMgrSql</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>
<span class="k">while</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">queryEvent</span><span class="p">(</span><span class="n">hEvent</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="o">.</span><span class="n">TPI_ERR_EVENTNOEND</span><span class="p">):</span>
	<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.02</span><span class="p">)</span>

<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;DBUM set CLUSTERCENTERNODE ON&quot;</span>
<span class="n">hEvent</span><span class="p">,</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="o">.</span><span class="n">execMgrSql</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>

<span class="k">while</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">queryEvent</span><span class="p">(</span><span class="n">hEvent</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="o">.</span><span class="n">TPI_ERR_EVENTNOEND</span><span class="p">):</span>
	<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.02</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sNodes</span><span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">clusterGetActiveNodes</span><span class="p">()</span>



</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getCommunicationHandle">
<code class="sig-name descname">getCommunicationHandle</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getCommunicationHandle" title="永久链接至目标">¶</a></dt>
<dd><p>得到通信句柄</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码通信句柄,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getCommunicationHandle</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">hFTSCon</span><span class="p">,</span>  <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getCommunicationHandle</span><span class="p">()</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getRowNativeId">
<code class="sig-name descname">getRowNativeId</code><span class="sig-paren">(</span><em class="sig-param">rowno</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getRowNativeId" title="永久链接至目标">¶</a></dt>
<dd><p>取记录内部唯一ID</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>rowno</strong> – 记录序号</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码记录内部ID,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getRowNativeId</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sTableName</span><span class="p">,)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nRowID</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getRowNativeId</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getStorageSpaceName">
<code class="sig-name descname">getStorageSpaceName</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getStorageSpaceName" title="永久链接至目标">¶</a></dt>
<dd><p>得到表的存储空间名列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,存储空间名列表)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getStorageSpaceName</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="c1">#nFlag  标识：0-名称 1-名称:类型 </span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sSpaceName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getStorageSpaceName</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="n">nFlag</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getHotStarConfigParam">
<code class="sig-name descname">getHotStarConfigParam</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getHotStarConfigParam" title="永久链接至目标">¶</a></dt>
<dd><p>得到系统配置参数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>无</strong> – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,CONFIG_PARAM)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getHotStarConfigParam</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="k">def</span> <span class="nf">PrintMemOpt</span><span class="p">(</span><span class="n">memOpt</span><span class="p">):</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;DeviceBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">DeviceBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;RecordBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">RecordBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;LxtBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">LxtBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;LinkBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">LinkBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;TextIdBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">TextIdBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;GIdBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">GIdBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;MemSizePerRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">MemSizePerRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;TextMergeRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">TextMergeRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;TextCountPerRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">TextCountPerRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;CharCountPerRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">CharCountPerRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;FullFieldTextMergeRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">FullFieldTextMergeRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;FullFieldTextCountPerRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">FullFieldTextCountPerRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nQueryCacheCountForLocalTable = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">nQueryCacheCountForLocalTable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nQueryCacheCountForTeleTable = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">nQueryCacheCountForTeleTable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nQueryCacheCountForUspTable = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">nQueryCacheCountForUspTable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;importDataIndexOn = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">importDataIndexOn</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;logDebugMsg = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">logDebugMsg</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;loadLocalDict = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">loadLocalDict</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;loadUnicodeDict = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">loadUnicodeDict</span><span class="p">)</span>
 
<span class="k">def</span> <span class="nf">PrinConfigParam</span><span class="p">(</span><span class="n">configParam</span><span class="p">):</span>
        <span class="n">PrintMemOpt</span><span class="p">(</span><span class="n">configParam</span><span class="o">.</span><span class="n">memParam</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_nBTreeBuf = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_nBTreeBuf</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_nRecordBuf = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_nRecordBuf</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_nDataFileBuf = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_nDataFileBuf</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_IsCreateSysTable = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_IsCreateSysTable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_IsFixDatabase = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_IsFixDatabase</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nClusterEnable = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">nClusterEnable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;isClusterCenterNode = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">isClusterCenterNode</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;isClusterNode = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">isClusterNode</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;szClusterCenterIP = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">szClusterCenterIP</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nClusterCenterPort = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">nClusterCenterPort</span><span class="p">)</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">configParam</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getHotStarConfigParam</span><span class="p">()</span>
<span class="n">PrinConfigParam</span><span class="p">(</span><span class="n">configParam</span><span class="p">)</span>
        


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setHotStarConfigParam">
<code class="sig-name descname">setHotStarConfigParam</code><span class="sig-paren">(</span><em class="sig-param">params</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setHotStarConfigParam" title="永久链接至目标">¶</a></dt>
<dd><p>设定系统配置参数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>params</strong> – CONFIG_PARAM类对象</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.setHotStarConfigParam</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="k">def</span> <span class="nf">PrintMemOpt</span><span class="p">(</span><span class="n">memOpt</span><span class="p">):</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;DeviceBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">DeviceBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;RecordBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">RecordBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;LxtBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">LxtBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;LinkBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">LinkBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;TextIdBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">TextIdBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;GIdBuffer = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">GIdBuffer</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;MemSizePerRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">MemSizePerRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;TextMergeRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">TextMergeRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;TextCountPerRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">TextCountPerRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;CharCountPerRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">CharCountPerRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;FullFieldTextMergeRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">FullFieldTextMergeRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;FullFieldTextCountPerRoad = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">FullFieldTextCountPerRoad</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nQueryCacheCountForLocalTable = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">nQueryCacheCountForLocalTable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nQueryCacheCountForTeleTable = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">nQueryCacheCountForTeleTable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nQueryCacheCountForUspTable = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">nQueryCacheCountForUspTable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;importDataIndexOn = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">importDataIndexOn</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;logDebugMsg = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">logDebugMsg</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;loadLocalDict = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">loadLocalDict</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;loadUnicodeDict = &quot;</span><span class="p">,</span> <span class="n">memOpt</span><span class="o">.</span><span class="n">loadUnicodeDict</span><span class="p">)</span>
 
<span class="k">def</span> <span class="nf">PrinConfigParam</span><span class="p">(</span><span class="n">configParam</span><span class="p">):</span>
        <span class="n">PrintMemOpt</span><span class="p">(</span><span class="n">configParam</span><span class="o">.</span><span class="n">memParam</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_nBTreeBuf = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_nBTreeBuf</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_nRecordBuf = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_nRecordBuf</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_nDataFileBuf = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_nDataFileBuf</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_IsCreateSysTable = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_IsCreateSysTable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;m_IsFixDatabase = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">m_IsFixDatabase</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nClusterEnable = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">nClusterEnable</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;isClusterCenterNode = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">isClusterCenterNode</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;isClusterNode = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">isClusterNode</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;szClusterCenterIP = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">szClusterCenterIP</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;nClusterCenterPort = &quot;</span><span class="p">,</span> <span class="n">configParam</span><span class="o">.</span><span class="n">nClusterCenterPort</span><span class="p">)</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">configParam</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getHotStarConfigParam</span><span class="p">()</span>
<span class="n">configParam</span><span class="o">.</span><span class="n">memParam</span><span class="o">.</span><span class="n">DeviceBuffer</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="p">(</span><span class="n">nErr</span><span class="p">,)</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setHotStarConfigParam</span><span class="p">(</span><span class="n">configParam</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">configParam</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getHotStarConfigParam</span><span class="p">()</span>
<span class="n">PrinConfigParam</span><span class="p">(</span><span class="n">configParam</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.sessionAccess">
<code class="sig-name descname">sessionAccess</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.sessionAccess" title="永久链接至目标">¶</a></dt>
<dd><p>对表的一次会话访问报告</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.sessionAccess</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span>  <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">sessionAccess</span><span class="p">(</span><span class="n">sTableName</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getIndexSpaceName">
<code class="sig-name descname">getIndexSpaceName</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getIndexSpaceName" title="永久链接至目标">¶</a></dt>
<dd><p>得到表的索引空间名列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,索引空间名列表)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getIndexSpaceName</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sSpaceName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getIndexSpaceName</span><span class="p">(</span><span class="n">sTableName</span><span class="p">)</span>
        


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.grantAllDBField">
<code class="sig-name descname">grantAllDBField</code><span class="sig-paren">(</span><em class="sig-param">ads</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.grantAllDBField" title="永久链接至目标">¶</a></dt>
<dd><p>设定用户对数据库字段的权限</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>ads</strong> – TPI_ACCOUNT_DBRIGHT类元组或列表</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.grantAllDBField</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">right</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_ACCOUNT_DBRIGHT</span><span class="p">()</span>
<span class="n">right</span><span class="o">.</span><span class="n">userDB</span><span class="o">.</span><span class="n">lUser</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">right</span><span class="o">.</span><span class="n">userDB</span><span class="o">.</span><span class="n">szName</span> <span class="o">=</span>  <span class="s2">&quot;dbown&quot;</span>
<span class="n">right</span><span class="o">.</span><span class="n">userDB</span><span class="o">.</span><span class="n">szDbName</span> <span class="o">=</span>  <span class="s2">&quot;person&quot;</span>
<span class="n">right</span><span class="o">.</span><span class="n">Mark</span> <span class="o">=</span> <span class="s2">&quot;name&quot;</span>
<span class="n">nErrCode</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">grantAllDBField</span><span class="p">((</span><span class="n">right</span><span class="p">,))</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.grantAllDBRight">
<code class="sig-name descname">grantAllDBRight</code><span class="sig-paren">(</span><em class="sig-param">ads</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.grantAllDBRight" title="永久链接至目标">¶</a></dt>
<dd><p>设定用户对表的权限</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>ads</strong> – TPI_ACCOUNT_DBRIGHT类元组或列表</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.grantAllDBRight</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">right</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_ACCOUNT_DBRIGHT</span><span class="p">()</span>
<span class="n">right</span><span class="o">.</span><span class="n">userDB</span><span class="o">.</span><span class="n">lUser</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">right</span><span class="o">.</span><span class="n">userDB</span><span class="o">.</span><span class="n">szName</span> <span class="o">=</span>  <span class="s2">&quot;dbown&quot;</span>
<span class="n">right</span><span class="o">.</span><span class="n">userDB</span><span class="o">.</span><span class="n">szDbName</span> <span class="o">=</span>  <span class="s2">&quot;person&quot;</span>
<span class="n">right</span><span class="o">.</span><span class="n">Mark</span> <span class="o">=</span> <span class="s2">&quot;name&quot;</span>
<span class="n">nErrCode</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">grantAllDBRight</span><span class="p">((</span><span class="n">right</span><span class="p">,))</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getStorageSpaceInfo">
<code class="sig-name descname">getStorageSpaceInfo</code><span class="sig-paren">(</span><em class="sig-param">tablename</em>, <em class="sig-param">storagespacename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getStorageSpaceInfo" title="永久链接至目标">¶</a></dt>
<dd><p>得到表的存储空间的信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名</p></li>
<li><p><strong>storagespacename</strong> – 存储空间名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,TPI_TABLE_STORAGESPACE)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getStorageSpaceInfo</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>  
<span class="n">nErr</span><span class="p">,</span> <span class="n">SpaceInfo</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getStorageSpaceInfo</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="n">sSSName</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;tableName = &quot;</span><span class="p">,</span> <span class="n">SpaceInfo</span><span class="o">.</span><span class="n">tableName</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;name = &quot;</span><span class="p">,</span> <span class="n">SpaceInfo</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;type = &quot;</span><span class="p">,</span> <span class="n">SpaceInfo</span><span class="o">.</span><span class="n">type</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;lColCount = &quot;</span><span class="p">,</span> <span class="n">SpaceInfo</span><span class="o">.</span><span class="n">lColCount</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;lColLen = &quot;</span><span class="p">,</span> <span class="n">SpaceInfo</span><span class="o">.</span><span class="n">lColLen</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;szCol = &quot;</span><span class="p">,</span> <span class="n">SpaceInfo</span><span class="o">.</span><span class="n">szCol</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.validateDBField">
<code class="sig-name descname">validateDBField</code><span class="sig-paren">(</span><em class="sig-param">ads</em>, <em class="sig-param">fieldlst</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.validateDBField" title="永久链接至目标">¶</a></dt>
<dd><p>校验用户对字段的权限</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ads</strong> – HS_ACCOUNT_DBNAME类对象</p></li>
<li><p><strong>fieldlst</strong> – 字段列表</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.validateDBField</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">dbName</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_ACCOUNT_DBNAME</span><span class="p">()</span>
<span class="n">dbName</span><span class="o">.</span><span class="n">lUser</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">dbName</span><span class="o">.</span><span class="n">szName</span> <span class="o">=</span> <span class="s2">&quot;dbown&quot;</span>
<span class="n">dbName</span><span class="o">.</span><span class="n">szDbName</span> <span class="o">=</span> <span class="s2">&quot;person&quot;</span> 
<span class="n">sfieldList</span> <span class="o">=</span> <span class="s2">&quot;Name, Age&quot;</span>

<span class="n">nErrCode</span><span class="p">,</span> <span class="o">=</span>  <span class="n">client</span><span class="o">.</span><span class="n">validateDBField</span><span class="p">(</span><span class="n">dbName</span><span class="p">,</span> <span class="n">sfieldList</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.validateDBRight">
<code class="sig-name descname">validateDBRight</code><span class="sig-paren">(</span><em class="sig-param">ads</em>, <em class="sig-param">rightmode</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.validateDBRight" title="永久链接至目标">¶</a></dt>
<dd><p>校验用户对数据库的权限</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ads</strong> – HS_ACCOUNT_DBNAME类对象</p></li>
<li><p><strong>rightmode</strong> – 权限模式</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.validateDBRight</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">conn</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">cursor</span><span class="p">)</span>
<span class="n">dbName</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_ACCOUNT_DBNAME</span><span class="p">()</span>
<span class="n">dbName</span><span class="o">.</span><span class="n">lUser</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">dbName</span><span class="o">.</span><span class="n">szName</span> <span class="o">=</span> <span class="s2">&quot;dbown&quot;</span>
<span class="n">dbName</span><span class="o">.</span><span class="n">szDbName</span> <span class="o">=</span> <span class="s2">&quot;person&quot;</span> 

<span class="n">nErrCode</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">validateDBRight</span><span class="p">(</span><span class="n">dbName</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setFieldMap">
<code class="sig-name descname">setFieldMap</code><span class="sig-paren">(</span><em class="sig-param">tablename</em>, <em class="sig-param">mapiteminfos</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setFieldMap" title="永久链接至目标">¶</a></dt>
<dd><p>设定字段映射表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名</p></li>
<li><p><strong>mapiteminfos</strong> – HS_FIELD_MAP_ITEM类元组或列表</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.setFieldMap</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
        
<span class="n">mapItem</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_FIELD_MAP_ITEM</span><span class="p">()</span>
<span class="n">mapItem</span><span class="o">.</span><span class="n">srcNum</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">mapItem</span><span class="o">.</span><span class="n">mapNum</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">mapItem</span><span class="o">.</span><span class="n">property</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_FIELD_MAP_ITEM</span><span class="o">.</span><span class="n">FM_TYPE_NORMAL</span>
<span class="n">mapItem</span><span class="o">.</span><span class="n">weight</span> <span class="o">=</span> <span class="mi">5</span>
        
<span class="n">nErrCode</span><span class="p">,</span> <span class="o">=</span>  <span class="n">client</span><span class="o">.</span><span class="n">setFieldMap</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="p">(</span><span class="n">mapItem</span><span class="p">,))</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getFieldMap">
<code class="sig-name descname">getFieldMap</code><span class="sig-paren">(</span><em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getFieldMap" title="永久链接至目标">¶</a></dt>
<dd><p>得到字段映射表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tablename</strong> – 表名</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,HS_FIELD_MAP_ITEM)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getFieldMap</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
            
<span class="n">mapItem</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_FIELD_MAP_ITEM</span><span class="p">()</span>
<span class="n">mapItem</span><span class="o">.</span><span class="n">srcNum</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">mapItem</span><span class="o">.</span><span class="n">mapNum</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">mapItem</span><span class="o">.</span><span class="n">property</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">HS_FIELD_MAP_ITEM</span><span class="o">.</span><span class="n">FM_TYPE_NORMAL</span>
<span class="n">mapItem</span><span class="o">.</span><span class="n">weight</span> <span class="o">=</span> <span class="mi">5</span>

<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span>  <span class="n">client</span><span class="o">.</span><span class="n">setFieldMap</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="p">(</span><span class="n">mapItem</span><span class="p">,))</span>        
<span class="n">nErr</span><span class="p">,</span> <span class="n">mapItem2</span> <span class="o">=</span>  <span class="n">client</span><span class="o">.</span><span class="n">getFieldMap</span><span class="p">(</span><span class="n">sTableName</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;ItemCount = &quot;</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">mapItem</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;srcNum = &quot;</span><span class="p">,</span> <span class="n">mapItem2</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">srcNum</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;mapNum = &quot;</span><span class="p">,</span> <span class="n">mapItem2</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">mapNum</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;weight = &quot;</span><span class="p">,</span> <span class="n">mapItem2</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">weight</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;property = &quot;</span><span class="p">,</span> <span class="n">mapItem2</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">property</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;maxcount = &quot;</span><span class="p">,</span> <span class="n">mapItem2</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">maxcount</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.predictRelevantConcept">
<code class="sig-name descname">predictRelevantConcept</code><span class="sig-paren">(</span><em class="sig-param">keyword</em>, <em class="sig-param">recount</em><span class="optional">[</span>, <em class="sig-param">clusteridfollowed</em>, <em class="sig-param">dbname</em>, <em class="sig-param">sep</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.predictRelevantConcept" title="永久链接至目标">¶</a></dt>
<dd><p>得到相关信息词列表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>keyword</strong> – 关键词</p></li>
<li><p><strong>recount</strong> – 返回相关词数目</p></li>
<li><p><strong>clusteridfollowed</strong> – 是否附加ClusterID[可选]</p></li>
<li><p><strong>dbname</strong> – 数据库词典名[可选]</p></li>
<li><p><strong>sep</strong> – 分割字符串[可选]</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,相关信息词列表)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.predictRelevantConcept</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sRelevantConcept</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">predictRelevantConcept</span><span class="p">(</span><span class="s2">&quot;computer&quot;</span><span class="p">,</span> <span class="mi">32</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">sRelevantConcept</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.usp_Connect">
<code class="sig-name descname">usp_Connect</code><span class="sig-paren">(</span><em class="sig-param">ip</em>, <em class="sig-param">port</em>, <em class="sig-param">username</em>, <em class="sig-param">passwd</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.usp_Connect" title="永久链接至目标">¶</a></dt>
<dd><p>连接USP server</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ip</strong> – IP</p></li>
<li><p><strong>port</strong> – 端口号</p></li>
<li><p><strong>username</strong> – 账号</p></li>
<li><p><strong>passwd</strong> – 密码</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码连接句柄,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.usp_Connect</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span> 
<span class="n">hUsp</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_Connect</span><span class="p">(</span><span class="n">sUspHostIp</span><span class="p">,</span> <span class="n">nUspPort</span><span class="p">,</span> <span class="n">sUspUserName</span><span class="p">,</span> <span class="n">sUspPasswd</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.usp_GetTableCount">
<code class="sig-name descname">usp_GetTableCount</code><span class="sig-paren">(</span><em class="sig-param">huspcon</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.usp_GetTableCount" title="永久链接至目标">¶</a></dt>
<dd><p>取得USPserver上表个数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>huspcon</strong> – 连接句柄</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码表个数,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.usp_GetTableCount</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">hUsp</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_Connect</span><span class="p">(</span><span class="n">sUspHostIp</span><span class="p">,</span> <span class="n">nUspPort</span><span class="p">,</span> <span class="n">sUspUserName</span><span class="p">,</span> <span class="n">sUspPasswd</span><span class="p">)</span>
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableCount</span><span class="p">(</span><span class="n">hUsp</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.usp_GetTableName">
<code class="sig-name descname">usp_GetTableName</code><span class="sig-paren">(</span><em class="sig-param">huspcon</em>, <em class="sig-param">tableno</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.usp_GetTableName" title="永久链接至目标">¶</a></dt>
<dd><p>取得USPServer表名称</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>huspcon</strong> – USP连接句柄</p></li>
<li><p><strong>tableno</strong> – 表序号</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,表名称)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.usp_GetTableName</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">hUsp</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_Connect</span><span class="p">(</span><span class="n">sUspHostIp</span><span class="p">,</span> <span class="n">nUspPort</span><span class="p">,</span> <span class="n">sUspUserName</span><span class="p">,</span> <span class="n">sUspPasswd</span><span class="p">)</span>   
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableCount</span><span class="p">(</span><span class="n">hUsp</span><span class="p">)</span>

<span class="k">if</span> <span class="n">nCount</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="n">sTableName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableName</span><span class="p">(</span><span class="n">hUsp</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.usp_GetFieldInfo">
<code class="sig-name descname">usp_GetFieldInfo</code><span class="sig-paren">(</span><em class="sig-param">huspcon</em>, <em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.usp_GetFieldInfo" title="永久链接至目标">¶</a></dt>
<dd><p>取得USP表的字段信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>huspcon</strong> – USP连接句柄</p></li>
<li><p><strong>tablename</strong> – 表名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,USP_FIELDINFO_RET)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.usp_GetFieldInfo</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">hUsp</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_Connect</span><span class="p">(</span><span class="n">sUspHostIp</span><span class="p">,</span> <span class="n">nUspPort</span><span class="p">,</span> <span class="n">sUspUserName</span><span class="p">,</span> <span class="n">sUspPasswd</span><span class="p">)</span>        
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableCount</span><span class="p">(</span><span class="n">hUsp</span><span class="p">)</span>
        
<span class="k">if</span> <span class="n">nCount</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="n">sTableName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableName</span><span class="p">(</span><span class="n">hUsp</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="n">fieldInfoRet</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetFieldInfo</span><span class="p">(</span><span class="n">hUsp</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">)</span>
	<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">fieldInfoRet</span><span class="o">.</span><span class="n">FieldInfo</span><span class="p">)):</span>
            <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;FieldIndex</span><span class="si">%d</span><span class="s2"> = </span><span class="si">%d</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">fieldInfoRet</span><span class="o">.</span><span class="n">FieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">iFieldIndex</span><span class="p">))</span>
            <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;FieldType</span><span class="si">%d</span><span class="s2"> = </span><span class="si">%d</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">fieldInfoRet</span><span class="o">.</span><span class="n">FieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">nFieldType</span><span class="p">))</span>
            <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;FieldName</span><span class="si">%d</span><span class="s2"> = </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">fieldInfoRet</span><span class="o">.</span><span class="n">FieldInfo</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">strFieldName</span><span class="p">))</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.usp_IsTableExist">
<code class="sig-name descname">usp_IsTableExist</code><span class="sig-paren">(</span><em class="sig-param">huspcon</em>, <em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.usp_IsTableExist" title="永久链接至目标">¶</a></dt>
<dd><p>判断该USP表在TPI是否存在</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>huspcon</strong> – USP连接句柄</p></li>
<li><p><strong>tablename</strong> – 表名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.usp_IsTableExist</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

<span class="n">hUsp</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_Connect</span><span class="p">(</span><span class="n">sUspHostIp</span><span class="p">,</span> <span class="n">nUspPort</span><span class="p">,</span> <span class="n">sUspUserName</span><span class="p">,</span> <span class="n">sUspPasswd</span><span class="p">)</span>

<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableCount</span><span class="p">(</span><span class="n">hUsp</span><span class="p">)</span>

<span class="k">if</span> <span class="n">nCount</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="n">sTableName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableName</span><span class="p">(</span><span class="n">hUsp</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_IsTableExist</span><span class="p">(</span><span class="n">hUsp</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.usp_ConTable">
<code class="sig-name descname">usp_ConTable</code><span class="sig-paren">(</span><em class="sig-param">savepath</em>, <em class="sig-param">tablename</em>, <em class="sig-param">ip</em>, <em class="sig-param">port</em>, <em class="sig-param">conname</em>, <em class="sig-param">conpassword</em><span class="optional">[</span>, <em class="sig-param">dbname</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.usp_ConTable" title="永久链接至目标">¶</a></dt>
<dd><p>新建USP表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>savepath</strong> – 存储路径</p></li>
<li><p><strong>tablename</strong> – 表名</p></li>
<li><p><strong>ip</strong> – IP</p></li>
<li><p><strong>port</strong> – 端口号</p></li>
<li><p><strong>conname</strong> – 连接用户名</p></li>
<li><p><strong>conpassword</strong> – 连接密码</p></li>
<li><p><strong>dbname</strong> – TPI数据库名称</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.usp_ConTable</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">hUsp</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_Connect</span><span class="p">(</span><span class="n">sUspHostIp</span><span class="p">,</span> <span class="n">nUspPort</span><span class="p">,</span> <span class="n">sUspUserName</span><span class="p">,</span> <span class="n">sUspPasswd</span><span class="p">)</span>
          
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableCount</span><span class="p">(</span><span class="n">hUsp</span><span class="p">)</span>
        
<span class="k">if</span> <span class="n">nCount</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="n">sTableName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableName</span><span class="p">(</span><span class="n">hUsp</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_ConTable</span><span class="p">(</span><span class="n">sPath</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">,</span> <span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="mi">2000</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">sDBName</span><span class="p">)</span>


	
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.usp_GetColInfo">
<code class="sig-name descname">usp_GetColInfo</code><span class="sig-paren">(</span><em class="sig-param">huspcon</em>, <em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.usp_GetColInfo" title="永久链接至目标">¶</a></dt>
<dd><p>取得USP server表字段的信息</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>huspcon</strong> – usp连接句柄</p></li>
<li><p><strong>tablename</strong> – 表名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,(HS_TABLE_FIELD,))</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.usp_GetColInfo</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
          
<span class="n">hUsp</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_Connect</span><span class="p">(</span><span class="n">sUspHostIp</span><span class="p">,</span> <span class="n">nUspPort</span><span class="p">,</span> <span class="n">sUspUserName</span><span class="p">,</span> <span class="n">sUspPasswd</span><span class="p">)</span>         
<span class="n">nCount</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableCount</span><span class="p">(</span><span class="n">hUsp</span><span class="p">)</span>
        
<span class="k">if</span> <span class="n">nCount</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="n">sTableName</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetTableName</span><span class="p">(</span><span class="n">hUsp</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="n">fieldInfoRet</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetFieldInfo</span><span class="p">(</span><span class="n">hUsp</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">)</span>
	<span class="n">nErr</span><span class="p">,</span> <span class="n">fieldInfoRet</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">usp_GetColInfo</span><span class="p">(</span><span class="n">hUsp</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">,</span> <span class="n">fieldInfoRet</span><span class="o">.</span><span class="n">nFiedCount</span><span class="p">)</span>



</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.tableReConHost">
<code class="sig-name descname">tableReConHost</code><span class="sig-paren">(</span><em class="sig-param">htable</em>, <em class="sig-param">ip</em>, <em class="sig-param">port</em>, <em class="sig-param">username</em>, <em class="sig-param">passwd</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.tableReConHost" title="永久链接至目标">¶</a></dt>
<dd><p>非本地表重新指定所在服务器</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>htable</strong> – 知识域句柄</p></li>
<li><p><strong>ip</strong> – IP</p></li>
<li><p><strong>port</strong> – 端口号</p></li>
<li><p><strong>username</strong> – 用户名</p></li>
<li><p><strong>passwd</strong> – 密码</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.vQExpandTo</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.normalizeInput">
<code class="sig-name descname">normalizeInput</code><span class="sig-paren">(</span><em class="sig-param">inputstring</em>, <em class="sig-param">tf</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.normalizeInput" title="永久链接至目标">¶</a></dt>
<dd><p>校正检索字符串</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputstring</strong> – 输入字符串</p></li>
<li><p><strong>tf</strong> – 词频</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,校正结果)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.normalizeInput</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">sSrc</span> <span class="o">=</span> <span class="s2">&quot;GERMANY (FEDERAL REPUBLIC)&quot;</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sDest</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">normalizeInput</span><span class="p">(</span><span class="n">sSrc</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.normalizeInputForSE">
<code class="sig-name descname">normalizeInputForSE</code><span class="sig-paren">(</span><em class="sig-param">inputstring</em>, <em class="sig-param">tf</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.normalizeInputForSE" title="永久链接至目标">¶</a></dt>
<dd><p>校正检索字符串</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputstring</strong> – 输入字符串</p></li>
<li><p><strong>tf</strong> – 词频</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,校正结果)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.normalizeInputForSE</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">sSrc</span> <span class="o">=</span> <span class="s2">&quot;GERMANY (FEDERAL REPUBLIC)&quot;</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sDest</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">normalizeInputForSE</span><span class="p">(</span><span class="n">sSrc</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.getIndexSpaceCol">
<code class="sig-name descname">getIndexSpaceCol</code><span class="sig-paren">(</span><em class="sig-param">tablename</em>, <em class="sig-param">indexspacename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.getIndexSpaceCol" title="永久链接至目标">¶</a></dt>
<dd><p>得到表的索引空间列名组合串</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tablename</strong> – 表名</p></li>
<li><p><strong>indexspacename</strong> – 索引空间名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,索引空间列名组合串)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.getIndexSpaceCol</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">indexSpaseField</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getIndexSpaceCol</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="n">sISName</span><span class="p">)</span>
        


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.randomSubSetQuery">
<code class="sig-name descname">randomSubSetQuery</code><span class="sig-paren">(</span><em class="sig-param">idseries</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.randomSubSetQuery" title="永久链接至目标">¶</a></dt>
<dd><p>随机获取查询游标</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>idseries</strong> – 记录ID元组</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,随机查询游标)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.randomSubSetQuery</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;select * from </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span><span class="p">,)</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nRowID</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getRowNativeId</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="c1">##TPI_RandomSubSetQuery没有实现，直接返回-6031</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">cursor</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">randomSubSetQuery</span><span class="p">((</span><span class="n">nRowID</span><span class="p">,))</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.refreshCluster">
<code class="sig-name descname">refreshCluster</code><span class="sig-paren">(</span><em class="sig-param">reload</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.refreshCluster" title="永久链接至目标">¶</a></dt>
<dd><p>刷新集群属性</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>reload</strong> – 是否重新读取配置文件</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.refreshCluster</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErrCode</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">refreshCluster</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.createZ3950Table">
<code class="sig-name descname">createZ3950Table</code><span class="sig-paren">(</span><em class="sig-param">tableinfo</em>, <em class="sig-param">tablehead</em>, <em class="sig-param">dbname</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.createZ3950Table" title="永久链接至目标">¶</a></dt>
<dd><p>创建3950虚表</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tableinfo</strong> – KBase.TPI_TABLE_INFO类对象</p></li>
<li><p><strong>tablehead</strong> – KBase.HS_TABLE_HEAD_Z3950类对象</p></li>
<li><p><strong>dbname</strong> – 数据库名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.vQExpandTo</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">tpiclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setRemoteCluster">
<code class="sig-name descname">setRemoteCluster</code><span class="sig-paren">(</span><em class="sig-param">ip</em>, <em class="sig-param">port</em>, <em class="sig-param">tablename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setRemoteCluster" title="永久链接至目标">¶</a></dt>
<dd><p>设置远程集群参数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ip</strong> – IP</p></li>
<li><p><strong>port</strong> – 端口号</p></li>
<li><p><strong>tablename</strong> – 表名</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.setRemoteCluster</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErrCode</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setRemoteCluster</span><span class="p">(</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="mi">4567</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setEvent">
<code class="sig-name descname">setEvent</code><span class="sig-paren">(</span><em class="sig-param">TPI_EVENT_RUNTYPE</em>, <em class="sig-param">cmdCode</em>, <em class="sig-param">subCmdCode</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setEvent" title="永久链接至目标">¶</a></dt>
<dd><p>提交事件</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>TPI_EVENT_RUNTYPE</strong> – TPI_EVENT_RUNTYPE类对象</p></li>
<li><p><strong>cmdCode</strong> – 主命令号</p></li>
<li><p><strong>subCmdCode</strong> – 从命令号</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.setEvent</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">iclient</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
        
<span class="n">eventInfo</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_EVENT_RUNTYPE</span><span class="p">()</span>
<span class="n">eventInfo</span><span class="o">.</span><span class="n">lType</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">eventInfo</span><span class="o">.</span><span class="n">lTime</span> <span class="o">=</span> <span class="mi">100000</span>
<span class="n">eventInfo</span><span class="o">.</span><span class="n">lDate</span> <span class="o">=</span> <span class="mi">20141209</span>

<span class="n">FileRec</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_FILE_REC_OUTPUT</span><span class="p">()</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">szTable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">szPackFile</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">%s%s</span><span class="s2">.txt&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">csTempPath</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">)</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">nStartRec</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">nEndRec</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">sqlWhere</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
<span class="n">field</span> <span class="o">=</span> <span class="s2">&quot;NAME, AGE&quot;</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setEvent</span><span class="p">(</span><span class="n">eventInfo</span><span class="p">,</span> <span class="mi">67</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">FileRec</span><span class="p">,</span> <span class="n">field</span><span class="p">)</span>
 
<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;INSERT INTO </span><span class="si">{0}</span><span class="s2">(NAME, AGE) VALUES(</span><span class="si">{1}</span><span class="s2">, </span><span class="si">{2}</span><span class="s2">)&quot;</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setEvent</span><span class="p">(</span><span class="n">eventInfo</span><span class="p">,</span> <span class="mi">32</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">sSQL</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">sTableName</span><span class="p">,</span> <span class="s2">&quot;E&quot;</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="kc">None</span><span class="p">)</span>

<span class="n">FileRec</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_FILE_REC_OUTPUT</span><span class="p">()</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">szTable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sTableName</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">szPackFile</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">%s%s</span><span class="s2">.txt&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">csTempPath</span><span class="p">,</span> <span class="n">sTableName</span><span class="p">)</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">nStartRec</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">nEndRec</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="n">FileRec</span><span class="o">.</span><span class="n">sqlWhere</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
<span class="n">field</span> <span class="o">=</span> <span class="s2">&quot;NAME, AGE&quot;</span>
<span class="n">hEvent</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">outputRecToText</span><span class="p">(</span><span class="n">FileRec</span><span class="p">,</span> <span class="n">field</span><span class="p">)</span>
<span class="k">while</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">queryEvent</span><span class="p">(</span><span class="n">hEvent</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="o">.</span><span class="n">TPI_ERR_EVENTNOEND</span><span class="p">):</span>
	<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.02</span><span class="p">)</span>

<span class="n">FileAppendTable</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_FILE_APPEND_TABLE</span><span class="p">()</span>
<span class="n">FileAppendTable</span><span class="o">.</span><span class="n">szTable</span> <span class="o">=</span> <span class="n">sTableName</span>
<span class="n">FileAppendTable</span><span class="o">.</span><span class="n">szPackFile</span> <span class="o">=</span> <span class="n">FileRec</span><span class="o">.</span><span class="n">szPackFile</span>
<span class="n">FileAppendTable</span><span class="o">.</span><span class="n">nStartRec</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="n">FileAppendTable</span><span class="o">.</span><span class="n">nEndRec</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setEvent</span><span class="p">(</span><span class="n">eventInfo</span><span class="p">,</span> <span class="mi">35</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">FileAppendTable</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>

<span class="n">BackupTable</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPI_BACKUP_TABLE</span><span class="p">()</span>
<span class="n">BackupTable</span><span class="o">.</span><span class="n">lZip</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">BackupTable</span><span class="o">.</span><span class="n">szTableName</span> <span class="o">=</span> <span class="n">sTableName</span>
<span class="n">BackupTable</span><span class="o">.</span><span class="n">szFilePath</span> <span class="o">=</span> <span class="n">csTempPath</span> <span class="o">+</span> <span class="n">sTableName</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setEvent</span><span class="p">(</span><span class="n">eventInfo</span><span class="p">,</span> <span class="mi">59</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">BackupTable</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.bulkUpdate">
<code class="sig-name descname">bulkUpdate</code><span class="sig-paren">(</span><em class="sig-param">ctlfilename</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.bulkUpdate" title="永久链接至目标">¶</a></dt>
<dd><p>利用数据文件更新数据</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>ctlfilename</strong> – 数据文件的控制文件名</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.bulkUpdate</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nIndex</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">sPathPattern</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">sameRecStru</span><span class="si">%d</span><span class="s2">.txt&quot;</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
     <span class="n">sFilePath</span> <span class="o">=</span> <span class="n">sPathPattern</span> <span class="o">%</span> <span class="p">(</span><span class="n">csTempPath</span><span class="p">,</span> <span class="n">nIndex</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">sFilePath</span><span class="p">):</span>
            <span class="n">nIndex</span> <span class="o">+=</span> <span class="mi">1</span>
    <span class="k">else</span><span class="p">:</span>
            <span class="n">file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">sFilePath</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span>
            <span class="n">file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;&lt;REC&gt;&quot;</span><span class="p">)</span>
            <span class="n">file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;&lt;name&gt;=BTREE&quot;</span><span class="p">)</span>
            <span class="n">file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;&lt;REC&gt;&quot;</span><span class="p">)</span>
            <span class="n">file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;&lt;name&gt;=DICT&quot;</span><span class="p">)</span>
            <span class="n">file</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
            <span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">bulkUpdate</span><span class="p">(</span><span class="n">sFilePath</span><span class="p">)</span>
            <span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">sFilePath</span><span class="p">)</span>
            <span class="k">break</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.setKeyWordMarkPara">
<code class="sig-name descname">setKeyWordMarkPara</code><span class="sig-paren">(</span><em class="sig-param">prefix</em>, <em class="sig-param">suffix</em>, <em class="sig-param">segwordsdicts</em>, <em class="sig-param">markdict</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.setKeyWordMarkPara" title="永久链接至目标">¶</a></dt>
<dd><p>设置标记关键词的参数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>prefix</strong> – 前缀</p></li>
<li><p><strong>suffix</strong> – 后缀</p></li>
<li><p><strong>segwordsdicts</strong> – 切词词典列表</p></li>
<li><p><strong>markdict</strong> – 标词词典列表</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.setKeyWordMarkPara</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;SELECT * FROM SYS_DICT_RELEVANT&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">,</span> <span class="n">cursor</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">setKeyWordMarkPara</span><span class="p">(</span><span class="s2">&quot;&lt;&quot;</span><span class="p">,</span> <span class="s2">&quot;&gt;&quot;</span><span class="p">,</span> <span class="s2">&quot;SYS_CONCEPT_DIC&quot;</span><span class="p">,</span> <span class="s2">&quot;SYS_CONCEPT_DIC&quot;</span><span class="p">)</span>


</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="TPIClient.markKeyWordEx">
<code class="sig-name descname">markKeyWordEx</code><span class="sig-paren">(</span><em class="sig-param">srcstring</em>, <em class="sig-param">prefix</em>, <em class="sig-param">suffix</em>, <em class="sig-param">segwordsdicts</em>, <em class="sig-param">markdict</em><span class="sig-paren">)</span><a class="headerlink" href="#TPIClient.markKeyWordEx" title="永久链接至目标">¶</a></dt>
<dd><p>标记关键词</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>srcstring</strong> – 源字符串</p></li>
<li><p><strong>prefix</strong> – 前缀</p></li>
<li><p><strong>suffix</strong> – 后缀</p></li>
<li><p><strong>segwordsdicts</strong> – 切词词典列表</p></li>
<li><p><strong>markdict</strong> – 标词词典列表</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,标记关键词)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.markKeyWordEx</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sDest</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">markKeyWordEx</span><span class="p">(</span><span class="s2">&quot;中国人民&quot;</span><span class="p">,</span> <span class="s2">&quot;中&quot;</span><span class="p">,</span> <span class="s2">&quot;民&quot;</span><span class="p">,</span> <span class="s2">&quot;SYS_DICT_RELEVANT&quot;</span><span class="p">,</span> <span class="s2">&quot;SYS_DICT_RELEVANT&quot;</span><span class="p">)</span>

</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt>
<code class="sig-name descname">queryEvent</code><span class="sig-paren">(</span><em class="sig-param">hevent</em><span class="sig-paren">)</span></dt>
<dd><p>查询事件是否完成</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>hevent</strong> – 事件句柄</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>(错误码,)</p>
</dd>
</dl>
<p>例:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#KBase.TPIClient.queryEvent</span>

<span class="kn">import</span> <span class="nn">KBase</span>

<span class="n">conn</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="p">(</span><span class="n">conn</span><span class="p">)</span>
<span class="n">sDBNamePattern</span> <span class="o">=</span> <span class="s2">&quot;TESTCASE_DB</span><span class="si">%d</span><span class="s2">&quot;</span>
<span class="n">nErr</span><span class="p">,</span> <span class="n">sDBList</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">getAllDatabaseName</span><span class="p">()</span> 
<span class="n">sDBList</span> <span class="o">=</span> <span class="n">sDBList</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;,&quot;</span><span class="p">)</span>
<span class="n">nIndex</span> <span class="o">=</span> <span class="mi">1</span>
<span class="k">while</span><span class="p">(</span><span class="kc">True</span><span class="p">):</span>
	<span class="n">sDBName</span> <span class="o">=</span> <span class="n">sDBNamePattern</span> <span class="o">%</span> <span class="p">(</span><span class="n">nIndex</span><span class="p">)</span>
	<span class="n">sDBName</span> <span class="o">=</span> <span class="n">sDBName</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span>
	<span class="k">if</span> <span class="n">sDBName</span> <span class="ow">in</span> <span class="n">sDBList</span><span class="p">:</span>
		<span class="n">nIndex</span> <span class="o">+=</span> <span class="mi">1</span>
		<span class="k">continue</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="n">nErr</span><span class="p">,</span>  <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">createDataBase</span><span class="p">(</span><span class="n">sDBName</span><span class="p">)</span>	
		<span class="n">sSQL</span> <span class="o">=</span> <span class="s2">&quot;DROP DATABASE </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sDBName</span><span class="p">,)</span>
		<span class="n">hEvent</span><span class="p">,</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">execMgrSql</span><span class="p">(</span><span class="n">sSQL</span><span class="p">)</span>
		<span class="k">while</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">queryEvent</span><span class="p">(</span><span class="n">hEvent</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">KBase</span><span class="o">.</span><span class="n">TPIClient</span><span class="o">.</span><span class="n">TPI_ERR_EVENTNOEND</span><span class="p">):</span>
			<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.02</span><span class="p">)</span>
		<span class="k">break</span>

</pre></div>
</div>
</dd></dl>

</dd></dl>

</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">PyKBase</a></h1>








<h3>导航</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="kbasemodule.html">KBase模块</a></li>
<li class="toctree-l1"><a class="reference internal" href="connection.html">connection类</a></li>
<li class="toctree-l1"><a class="reference internal" href="cursor.html">cursor类</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">TPIClient类</a></li>
<li class="toctree-l1"><a class="reference internal" href="TPIClient_Struct.html">TPIClient_Struct内容</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="cursor.html" title="上一章">cursor类</a></li>
      <li>Next: <a href="TPIClient_Struct.html" title="下一章">TPIClient_Struct内容</a></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">快速搜索</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="转向" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2019, ZZJ.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.2</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="_sources/TPIClient.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>